#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const long long INF = (long long)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
long long n;
int main() {
  cin >> n;
  long long k = n;
  for (long long i = 1; i <= k; ++i) {
    if (n - i <= 0) {
      cout << n;
      break;
    }
    n -= i;
  }
  return 0;
}
