#include <bits/stdc++.h>
using namespace std;

int main()
{
	long long n;
	cin >> n;

	long long ans = n + 1;
	long long m = n + 1;
	for( long long i = 1; i <= m; i++ ) {
		m -= i;
		ans--;
	}

	cout << ans << endl;
}

#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  ll n;
  cin >> n;
  ll l=1,r=2E9;
  while(l+1<r){
    ll tmp=(l+r)/2;
    if((1+tmp)*tmp<=2*(n+1)){
      l=tmp;
    }else{
      r=tmp;
    }
  }

  cout << n-l+1 << endl;

  return 0;
}
