#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long n;
  cin >> n;
  unsigned long long reg, temp;
  for (unsigned long long i = sqrt(n); i <= n; i++) {
    if ((1 + i) * i / 2 <= n && (1 + i + 1) * (i + 1) / 2 >= n) {
      reg = (1 + i) * (i) / 2;
      temp = i;
      break;
    }
  }
  unsigned long long tmp = n - reg;
  if (tmp != 0)
    cout << tmp;
  else
    cout << temp;
  return 0;
}
