#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long n;

    cin >> n;

    long long sum = 0;

    long long cnt = 0;

    long long i = 0;

    while (sum <= n + 1)
    {
        i++;
        sum += i;
        cnt++;
    }

    cnt--;

    cout << n - cnt + 1 << endl;
}

#include <bits/stdc++.h>
using namespace std;
using ll=long long;

ll b,c;

ll cnt(ll a){
    if(c<a) return 0;
    else return (c-a)/2+1;
}

int main(){
    cin>>b>>c;
    ll ans=0;
    if(b==0){
        ans=cnt(0)+cnt(3);
    }else if(b>0){
        ans=cnt(1)+cnt(4);
        if(c>=2*b) ans+=2*b;
        else ans+=cnt(0)+cnt(3);;
    }else{
        b*=-1;
        ans=cnt(0)+cnt(3);
        if(c>=2*b+1) ans+=2*b;
        else ans+=cnt(1)+cnt(4);
    }
    cout<<ans<<endl;
}
