X, Y, Z = map(int, input().split()) if Z == 1 and X == 1: print(0) elif Z <= X: print(Z) elif X < Z <= Y: print(Z - 1) elif Y <= Z: print(Z - 2)