#include <iostream>
#include <vector>
#include <string>
#include <math.h>

/* MACROS START */
#define input std::cin
#define for2(i,n) for(int i=0; i<n; i++)
#define for3(i,a,n) for(int i=a; i<n; i++)
#define for4(i,a,n,s) for(int i=a; i<n; i+=s)

using lint = long long int;
using namespace std;

template <typename T>
void printvec(T vec) {
  for (auto& a: vec)
	cout << a << " ";
  cout << endl;
}
/* MACROS END */

/* LIBRARY START */
/* LIBRARY END */

int main() {
  std::ios_base::sync_with_stdio(0);
  lint n; input >> n;
  lint lo = 0, hi = (lint) 1e10;
  while (lo < hi-1) {
	lint mid = (lo+hi)/2;
	if ((mid * (mid+1))/2 <= n+1)
	  lo = mid;
	else
	  hi = mid;
  }
  lint k = lo;
  /* cout << k << endl; */
  cout << n-k + 1 << endl;
}


#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main()
{
	int a; cin >> a;
	int now = 0, ind = 1;
	while(now + ind <= a + 1)
	{
		now += ind;
		ind ++;
	}
	cout << a + 1 - ind + 1  << '\n';
	return 0;
}