#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double pi = 3.14159265358979323846;
const long long mxN = 1e5 + 2;
void solve() {
  long long n;
  cin >> n;
  for (long long i = 1; i * i + i <= 2 * n; i++) {
    long long curr = i * (i + 1) / 2;
    long long next = (i + 1) * (i + 2) / 2;
    if (curr <= n && next > n) {
      long long diff = n - curr;
      if (diff == 0)
        cout << i;
      else
        cout << diff;
      return;
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
