import java.util.Scanner; public class P131 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); String n = sc.nextLine(); String[] nstrs = n.split(" "); int nint[] = new int[3]; for (int a=0;a<3;a++) { nint[a] = Integer.parseInt(nstrs[a]); } int x = nint[0]; int y = nint[1]; int d = nint[2]; int ans = 0; int flags = 0; if (d>x+y) { flags ++; } int xmax = 0; int xmin = 0; if (d<=x) { xmax = d; } else if (d>x) { xmax = x; } if (d>y) { xmin = d-y; } else if (d<=y) { xmin = 0; } if (flags == 0) { ans = xmax - (xmin - 1); } System.out.println(ans); } }