#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define mp make_pair
#define pb push_back
#define pll pair<LL,LL>
#define pii pair<int,int>
#define y second
#define x first
#define LL long long 
#define ULL unsigned long long 
#define sqr(x) ((x)*(x))
#define pi acos(-1)
#define pdd pair<double,double>
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
using namespace std;
void solve(){
    LL n;
    scanf("%lld",&n);
    LL tmp=n+1;
    LL Max=2e9+10,Min=0;
    while(Max>Min+1){
        LL mid=(Max+Min)/2;
        if(mid*(mid+1)/2<=n+1)Min=mid;
        else Max=mid;
    }
    printf("%lld\n",n+1-Min);
}
int main(){
    int t=1;
   // scanf("%d",&t);
    while(t--){
        solve();
    }
}
#include <bits/stdc++.h>
using namespace std;
int main() {
  long N;
  cin >> N;
  long count = 0;
  long tasu = 0;
  for(long i = 1; i <= N+1; i++) {
    tasu += i;
    if(tasu > N+1) break;
    count++;
  }
  cout << N + 1 - count << endl;
}