#include <bits/stdc++.h>
using namespace std;
int main() {
  long double n;
  long double x;
  cin >> n;
  x = (-1 + sqrt(1 + 8 * n)) / 2;
  if (x == floor(x))
    x = floor(x) - 1;
  else
    x = floor(x);
  long long y = x * (x + 1) / 2;
  cout << (long long)n - y << "\n";
}
