l, r, m = list(map(int, input().split(' '))) print(min([m, (r - l + 1)]))