#include <bits/stdc++.h>
template <typename T>
T expo(T b, T e, const T &m) {
  if (e <= 1) return e == 0 ? 1 : b;
  return (e & 1) == 0 ? expo((b * b) % m, e >> 1, m)
                      : (b * expo((b * b) % m, e >> 1, m)) % m;
}
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long aux = (sqrt(1 + 8 * n) - 1) / 2;
  long long sqr = aux;
  sqr *= (aux + 1);
  sqr /= 2;
  if (n == sqr)
    cout << aux;
  else
    cout << n - sqr;
  return 0;
}
