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