#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  long long i, n, res, sum = 0;
  cin >> n;
  i = 0;
  while (sum / n != 1) {
    i++;
    sum += i;
  }
  res = i - (sum - n);
  cout << res << endl;
  return 0;
}
