/*Rabbi Zidni Ilma*/
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define scl(n) scanf("%lld",&n)
#define scll(n,m) scanf("%lld %lld",&n,&m)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define mod 1000000007
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)

int main()
{
	ll n,i,sum=0;
	cin >> n;
	
	for(i=1;i<=n;i++)
	{
		sum+=i;
		if(sum>=n+1)
		break;
	}
	if(sum==n+1)
	printf("%lld\n",n+1-i);
	else
	printf("%lld\n",n+2-i);
	return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define double long double
#define x first
#define y second
#define vi vector <int>
#define L nod<<1
#define R ((nod<<1)|1)
#define int ll
#define pi pair<int, int>
#define PI 3.1415926
const ll mod=998244353;
int n, ans;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin >> n;
    ans = n;

    int cur = 1;
    while(n+1 >= cur){
        n -= cur;
        // cout << cur << " " << n+1 << endl;
        cur++;
    }
    cur--;

    ans -= (cur-1);
    cout << ans;
}
