#include typedef long long ll; using namespace std; int INF = 1e9; int MOD = 1e9+7; main(){ int x,y,d; cin >> x >> y >> d; int cnt = min(x,y); if(d < min(x,y) || d > max(x,y)){ cnt -= min(abs(min(x,y)-d),abs(max(x,y)-d)); } if(cnt < 0)cnt = 0; else cnt++; cout << cnt << endl; }