L,R,M = map(int,input().split()) remainders=min(R-(L-1),M) print(remainders)