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