#include <bits/stdc++.h>
using namespace std;
int main() {
  long long low = 0, a;
  cin >> a;
  while (a > 0) {
    a -= low;
    low++;
    if (a - low <= 0) {
      for (int i = 1; i <= a; i++) {
        if (i == a) {
          cout << i;
          return 0;
        }
      }
    }
  }
}
