#include <iostream>
using namespace std;

int main(void) {
  unsigned long long n, n1, m;
  cin >> n;
  n1 = n + 1; // n+1本目の残り長さ
  m = 1; // 最初に切る木の長さ = n+1本目の木で賄えた本数 - 1
  
  while(true)
    if (n1 >= m) {//次の長さの木を賄えたら
      n1 -= m; //n+1本目の木を切る
      m++;    //次に賄う木の長さ+1増加 = n+1本目の木で賄えた本数 + 1
    } else
      break;
  
  cout << n + 2 - m << endl;
  return 0;
}
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
// using namespace atcoder;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll n; cin >> n;
    ll l = 1, r = 2002002002;
    while(l+1<r){
        ll m = (l+r) /2;
        if(m*(m+1)/2 <= n+1) l = m;
        else r = m;
    }

    ll ans = n+1 - l;
    cout << ans << endl;
    return 0;
}


