#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N = 0;
  cin >> N;
  long long lo = 0, hi = 100000000;
  while (lo < hi) {
    long long mid = lo + (hi - lo) / 2;
    if (mid * (mid + 1) / 2 < N)
      lo = mid + 1;
    else
      hi = mid;
  }
  cout << N - (lo * (lo - 1) / 2) << endl;
}
