#include #define REP(i,s,n) for(int i=s;i> x >> y >> d; if( d > max(x,y) ) puts("0"); else cout << min(min(x+1,d+1),min(y+1,d+1)) << endl; return 0; }