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