L, R, M = map(int, input().split()) print(min(M, R - L + 1))