l, r, m = map(int, input().split()) if r-l+1 >= m: print(m) else: print(r-l+1)