import sys input=lambda: sys.stdin.readline().rstrip() l,r,m=map(int,input().split()) print(min(r-l+1,m))