x, y, z = map(int, input().split()) if z >= x and z > 0: z -= 1 if z >= y and z > 0: z -= 1 print(z)