#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, n, k, p;
  scanf("%lld", &k);
  ;
  n = sqrt(1 + 8 * k);
  n = (n - 1) / 2;
  p = (n * (n + 1)) / 2;
  k -= p;
  if (k)
    cout << k << endl;
  else
    cout << n << endl;
  return 0;
}
