import sys stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) nn = lambda: list(stdin.readline().split()) ns = lambda: stdin.readline().rstrip() l,r,m = na() print(min(l-r+1,m))