L,R,M = map(int,input().split()) if R-L >= M: print(M) else: print(R-L+1)