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