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