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