#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF = 1LL << 60;

int main()
{
    ll n;
    cin >> n;
    ll ans = n + 1;

    ll tmp = 0;
    ll num = 1;
    while (tmp + num <= n + 1)
    {
        ans--;
        tmp += num;
        num++;
    }

    cout << ans << '\n';
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
//inline unsigned long long read()
//{
//	unsigned long long sum=0,nega=1;char ch=getchar();
//	while(ch>'9'||ch<'0'){if(ch=='-')nega=-1;ch=getchar();}
//	while(ch<='9'&&ch>='0')sum=sum*10+ch-'0',ch=getchar();
//	return sum*nega;
//}
unsigned long long n,res,ans,mid;
int main()
{
	cin>>n;
	res=n*8+9;
	unsigned long long l=0,r=4e9;
	while(l<r)
	{
		mid=(l+r+1)/2;
		if(mid*mid<=res)l=mid;
		else r=mid-1;
	}
	if(l*l<=res)ans=l;
	else ans=r;
	ans=(ans-1)/2;
	cout<<n-ans+1<<endl;
	//cout<<min((sum*2-1)*x,x+)<<endl;
	return 0;
}
