c = 0 X, Y, Z = (int(x) for x in input().split()) if X <= Z < Y: c = Z - 1 if Y <= Z: c = Z - 2 print(c)