#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long lower = sqrt(n * 2);
  long long rest = n - (lower) * (lower + 1) / 2;
  if (rest < 0) {
    rest = n - lower * (lower - 1) / 2;
    if (rest == 0) {
      cout << (lower - 1) << endl;
      return 0;
    }
    cout << rest << endl;
    return 0;
  } else if (rest == 0) {
    cout << lower << endl;
    return 0;
  }
  cout << rest << endl;
  return 0;
}
