input_list = list(map(int,input().split())) x = input_list[0] y = input_list[1] z = input_list[2] res = z if z >= y: res -= 2 elif z < y and z >= x: res -= 1 print(res)