#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define fz(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define ffe(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define fill0(a) memset(a,0,sizeof(a))
#define fill1(a) memset(a,-1,sizeof(a))
#define fillbig(a) memset(a,63,sizeof(a))
#define pb push_back
#define ppb pop_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
ll n;
int main(){
	scanf("%lld",&n);
	ll l=1,r=2e9,ans=0;
	while(l<=r){
		int mid=(l+r)>>1;
		if(1ll*mid*(mid+1)/2ll<=n+1) ans=mid,l=mid+1;
		else r=mid-1;
	}
	printf("%lld\n",n+1-ans);
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef int64_t lint;
#define rep(i, n) for(lint i=0; i<n; i++)

int main() {
	lint N;
	cin >> N;
	lint a=0, b=0, c=N+1, x, y, z;
	rep(i, N) {
		c -= i+1;
		if (c >= 0) a++;
		else break;
	}
	std::cout << N+1-a << '\n';
}
