L,R,m = map(int,input().split()) print(min(R-L+1,m))