#include <bits/stdc++.h>
using namespace std;
long long n, root, val, rem;
int main() {
  cin >> n;
  root = floor((sqrt(1.0 + 8.0 * n) - 1.0) / 2.0);
  val = root * (root + 1) / 2;
  if (n == val) --root;
  val = root * (root + 1) / 2;
  rem = n - val;
  cout << rem << endl;
  return 0;
}
