#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int pos;
  cin >> pos;
  long long tmp = 0;
  long long n;
  for (int i = 1; i < 1000000000; i++) {
    tmp += i;
    if (tmp > pos) {
      n = n - (tmp - i);
      break;
    }
    if (tmp == pos) {
      n = i;
      break;
    }
  }
  cout << n;
  cout << endl;
}
