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