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