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