///////////////////////////////
////ACくれなきゃ悪戯しちゃうぞ!////
///////////////////////////////
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
#include <functional>
#include <cstdlib>
#include <map>
#include <utility>
#include <set>
#include <deque>
//using
using namespace std;
using vi = vector <int>;
using vl = vector <long long>;
using vs = vector <string>;
using vc = vector <char>;
using ll= long long;
using vvl = vector<vector<ll> >;
using vvc = vector<vector<char> >;
using vd = vector <double>;
using vpl = vector <pair<ll,ll> >;
//define
#define rep(i,r) for(ll i=0;i<(r);i++)
#define Rep(i,l,r) for(ll i=(l);i<(r);i++)
#define print(n) cout<<n<<endl;
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
#define all(n) n.begin(),n.end()
//素数判定　O(√A) 
bool is_prime(ll x){
 if(x<=1) return false;
 for(int i=2;i*i<=x;i++)
 if(x%i==0) return false;
 return true;
 }
 //各位の和　
int wa(ll x)
{
ll sum = 0;
while(x!=0){
  sum += x% 10;
  x /= 10;
}
return sum;
}
/*順列生成
do {
  // 順列に対する処理
} while (next_permutation(配列変数.begin(), 配列変数.end()));*/
//最大公約数　ユークリッドの互除法
ll gcd(ll a, ll b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
//最小公倍数　a*b/gcd
ll lcm(ll a, ll b) {
    return a/gcd(a, b)*b;
}
//10進→２進
ll binary(ll bina){
    ll ans = 0;
    for (ll i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}
//'A'65,'a'97
//reverse 回文
/*for(const auto& [x,y]:m)    mapの範囲for
  {
    q+=y*(y-1)/2;
  }*/
/*小数点精度指定
cout<<fixed<<setprecision(9)<<;
*/
//文字列の削除 erase(n)

//グローバル変数宣言等
ll p=0,q=0,r=0;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
#define inf 1000000000000 //10^12:∞
#define mod 1000000007 //10^9+7:合同式の法
int main()
{ 
  unsigned long long n;cin>>n;
  if(n==1||n==2||n==3)
  {
    print(n/3+1)return 0;
  }
  for (unsigned long long i = 0; i < n; i++)
  {
    if(i%2==0)
    {
      p=i/2*(i+1);
    }else
    p=(i+1)/2*(i);
    if(1+n<p)
    {
      print(n-i+2);return 0;
    }
  }
}
#include<bits/stdc++.h>
using namespace std;

int main(){
  int64_t n;
  cin>>n;
  int64_t cnt=0,sum=0;
  while(cnt+sum<=n)sum+=++cnt;
  cout<<n-cnt+1<<'\n';
}