X, Y, Z = input().strip().split(' ') X, Y, Z = int(X), int(Y), int(Z) s = Z if X <= Z: s -= 1 if (X != Y) and (Y <= Z): s -= 1 print(s)