X, Y, Z = [int(i) for i in input().strip().split(' ')] print(Z - (1 if Z >= X else 0) - (1 if Z >= Y else 0))