x,y,z = map(int,input().split()) ans = z if z >= x: ans -= 1 if z >= y: ans -= 1 print(max(ans,0))