#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long s, n, r;
  cin >> s;
  n = sqrt(0.25 + 2 * s) - 0.5;
  r = s - (n * n + n) / 2;
  if (r == 0)
    cout << n;
  else
    cout << r;
  return 0;
}
