n = input() m = n.split() p = [int(i) for i in m] if p[2] < p[0]: print(p[2]) elif p[2]< p[1]: print(p[2] - 1) else: print(p[2] - 2)