#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,l,r,mid;
	scanf("%lld",&n),l=1,r=n;
	while(l<r){
		mid=(l+r+1)>>1;
		if(mid+1<=((n+1)<<1)/mid)l=mid;
		else r=mid-1;
	}printf("%lld\n",n+1-r);
	return 0;
}
// Problem: B - log
// Contest: AtCoder - AtCoder Regular Contest 109
// URL: https://atcoder.jp/contests/arc109/tasks/arc109_b
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll> 
#define all(x) (x).begin() , (x).end()
 
void dbg(){
	cerr << endl;
}
template<typename Head , typename... Tail>
void dbg(Head h , Tail... t){
	cerr << h << " ";
	dbg(t...);
}
 
#ifdef EMBI_DEBUG
#define debug(...) cerr << "(" << #__VA_ARGS__  << "): ", dbg(__VA_ARGS__)
#else 
#define debug(...)
#endif
 
const int max_n = 1e5 + 9;
const int mod = 1e9 + 7;
const int inf = 1e12;
 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
void solve(){
	ll n;
	cin >> n;
	
	ll beg = 0 , last = inf , mid , ans;
	while(beg <= last){
		mid = beg + (last - beg) / 2;
		
		if((n+1) * (n+2) / 2 - mid * (mid + 1) / 2 >= n * (n + 1) / 2){
			ans = mid;
			beg = mid + 1;
		}
		else last = mid - 1;
	}
	
	cout << n - ans + 1 << "\n";
}
signed main(){
	int t = 1;
	// cin >> t;
	for(int i = 1 ; i <= t ; i++){
		solve();
	}
}