#include using namespace std; int main(){ int a,b,c;cin >> a >> b >> c; int cost1 = 0,cost2 = 0; cost1 = b - max(a,c) + 1; cost2 = abs(a-c); cout << min(cost1,cost2) << endl; }