#include <bits/stdc++.h>
using namespace std;
const long long N = 1e8;
long long n;
bool pred(long long m) { return m * (m - 1) / 2 < n; }
long long binary(long long lo, long long hi) {
  while (lo < hi) {
    long long mid = lo + (hi - lo + 1) / 2;
    if (pred(mid))
      lo = mid;
    else
      hi = mid - 1;
  }
  return lo * (lo - 1) / 2;
}
int main() {
  cin >> n;
  cout << n - binary(0, N);
}
