#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
 
int main() 
{
  ll n;
  cin >> n;
  
  ll left = 0;
  ll right = 2000000000;
 
  while(right - left > 1) 
  {
    ll x = (left + right) / 2;
    if(x * (x + 1) / 2 <= n + 1) left = x;
    else right = x;
  }
  cout << n + 1- left << endl;
 
    return 0;
}
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>
#include<map>
#include<cassert>

using namespace std;

#define ll long long
#define reps(i, a, b) for(int i = a; i < b; i++)
#define rreps(i, a, b) for(int i = a-1; i >= b; i--)
#define rep(i, n) reps(i, 0, n)
#define rrep(i, n) rreps(i, n, 0)
#define P pair<int, int>

const ll mod = 1000000007;
const int INF = 1001001001;

// bool C(ll x){
//     if(x > 1e9){

//     }
// }

int main(){
    ll n;
    cin >> n;
    ll m;
    ll ans = n+1;
    ll num = 1;
    for (ll i = 2; num <= n + 1; i++){
        ans--;
        num += i;
    }
    cout << ans << endl;
}