# -*- coding: utf-8 -*- import sys import copy # input = sys.stdin.readline # --------------------------------------------------------- L, R, M = map(int, input().split()) print(min(M, R - L + 1))