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