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