import java.util.*; public class Main { static TreeSet primes; public static void main (String[] args) { Scanner sc = new Scanner(System.in); int l = sc.nextInt(); int r = sc.nextInt(); int m = sc.nextInt(); System.out.println(Math.min(m, r - l + 1)); } }