#include <bits/stdc++.h>
typedef long long LL;
using namespace std;
LL n;
int main (){
	cin>>n; LL m=2*n+2, x=sqrt(n);
	while(x*(x+1)>m) x--; while(x*(x+1)<=m) x++;
	n -= x-1; printf("%lld\n",n+1);
}
#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ll long long
inline ll read(){ll x;scanf("%lld",&x);return x;}
ll Abs(ll x){if(x<0)return -x;return x;}

int main()
{
	ll n=read();
	__int128 L=0,R=n+1;
	while(L<R){
		__int128 Mid=(L+R+1)>>1;
		if((__int128)(1+Mid)*Mid/2<=n+1) L=Mid;
		else R=Mid-1;
	}
	cout<<n-(ll)L+1;
	return 0;
}