#include <bits/stdc++.h>
using namespace std;
const long long Max = 1e8;
int main() {
  long long n;
  long long l, r, mid;
  cin >> n;
  l = 0;
  r = Max;
  while (r - l > 1) {
    mid = (l + r) / 2;
    if ((1 + mid) * mid / 2 <= n) {
      l = mid;
    } else
      r = mid;
  }
  if ((l + 1) * l / 2 == n) {
    cout << l << endl;
  } else {
    long long s = (1 + l) * l / 2;
    s = n - s;
    cout << s << endl;
  }
}
