https://www.acmicpc.net/problem/2875
n,m,k=map(int,input().split()) c=n//2 count=m if c>=m else c re=n+m-3*count n=n-2*count m=m-count k-=re if k>0: a=k//3 b=k%3 if b==0: count-=a else: count-=a+1 print(count)