#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MN LLONG_MIN
#define MX LLONG_MAX
#define UL ULLONG_MAX
#define pb push_back
#define e "\n"
#define iff(u,v)  if(abs(u-v)<1e-9)
#define vi vector<long long>v,v1,v2;
#define pi 3.1415926536
#define fix cout<<fixed; cout<<setprecision(10);
#define dc ll i,j,k,n,m,len,ans=0,mx=-1,mn,sum=0; string s,t; bool flag=false;

void solve()
{
	dc;  cin>>n; m=n; ++m; k=1;
	while(k<=m)
	{
		m-=k; ++k; sum++;
	}
	cout<<n-sum+1<<e;
}

int main()
{
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);    
    //int t; cin>>t; while(t--)solve();
    solve(); 
}

#include<bits/stdc++.h>
using namespace std;
#define ff                first
#define brn                "\n"
#define ss                second
#define mk                make_pair
#define int               long long
#define pb                push_back
#define ps(x,y)           fixed<<setprecision(y)<<x
#define w(x)              int x; cin>>x; while(x--)
#define FOR(i,a,b)        for(int i=(a);i<(b);i++)
#define ROF(i,a,b)        for(int i=(a);i>=(b);i--)
#define so(a,n)           sort(a,a+n)
#define rso(a,n)          sort(a,a+n),reverse(a,a+n)
#define all(v)            (v).begin(),(v).end()
#define ps(x,y)           fixed<<setprecision(y)<<x
#define sz                size();
#define p_sieve           10000007
const int                 maxn = 1e3 + 5;
const int                 modulo=1000000007;
#define mod               1000000009;
const double              pi=3.14159;



void solve()
{
	
	int n;cin>>n;
	int i=1;
	while((i*(i+1))/2<=(n+1))i++;
	cout<<(n+1-i)+1;
}
//########################---------code ends here------------------########################################################
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
  //prime_sieve();
   // w(t)
    solve();
}
