l, r, m = map(int, input().split()) ans = min(r-l+1, m) print(ans)