X, Y, Z = map(int,input().split())
if Y <= Z:
    print(max(0,Z-2))
elif X <= Z < Y:
    print(max(0,Z-1))
else:
    print(max(0,Z))