#include <bits/stdc++.h>

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;
typedef long double ld;

const ll inf = 1e18;
const ll mod = 1e9+7;

int main() {
    ll n;
    cin>>n;

    ll L=0,R=2e9;

    while(R-L>1){
        ll m=(R+L)/2;
        if(m*(m+1)/2<=n+1)L=m;
        else R=m;
    }

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

#include<cstdio>
#define lli long long
lli n,a;
int main()
{
	scanf("%lld",&n),++n,a=n;
	for(register int i=1;;++i)
		if(n<i)return printf("%lld",a),0;
		else n-=i,--a;
	printf("%lld",a);
	return 0;
}