X, Y, Z = gets.split.map &:to_i
ans = Z
ans -= 1 if X <= Z
ans -= 1 if Y <= Z
p ans