x,y,z = input().split if int(x) > int(z): print(int(z)) elif int(x) <= int(z) == int(y): print(int(z) - 1) else: print(int(z) - 2)