L, R, M = [int(i) for i in input().split()] print(min(R - L + 1, M))