x,y,z = gets.split.map(&:to_i) result = z result -= 1 if x <= z result -= 1 if y <= z puts result