# No.810 割った余りの個数 L, R, M = [int(s) for s in input().split()] print(min(R - (L - 1), M))