import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines L,R,M = map(int,read().split()) n = R - L + 1 answer = min(n, M) print(answer)