X, Y, Z = gets.split.map(&:to_i) ans = Z if X <= Z ans -= 1 end if Y <= Z ans -= 1 end puts ans