#include <iostream> 
#include <string> 
#include <vector> 
#include <algorithm> 
using ll=long long; 
using ld=long double; 
using namespace std; 
int main(){ 
  ll n;cin>>n;ll res=0;
  ll m=n+1;ll ns=0;
  for(ll i=1;;i++){
    ns+=i;
    if(ns>m)break;
    res++;
  
  }
  cout<<n+1-res<<endl;
}
#include <bits/stdc++.h>
using namespace std;
#define fo(a,b) for(int64_t a=0;a<b;a++)
#define sor(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define ll int64_t
#define mod 1000000007
#define vl vector<int64_t>
int main(){
ll n;
  cin>>n;
  ll ub=n+2;
  ll lb=-1;
  while(ub-lb>1){
  ll mid=(lb+ub)/2;
    if(mid>=2*mod){ub=mid;}
    else{if(mid*(mid-1)<=(2*n)+2){lb=mid;}
    else{ub=mid;}}
  }

 cout<<(n+1)-lb+1<<endl;
  
}  