import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); int d = sc.nextInt(); int start = Math.max(0, d - x); int end = Math.min(y, d); System.out.println(Math.max(end - start + 1, 0)); } }