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