#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  n--;
  long long poz = 0, elem = 1;
  while (poz + elem <= n) {
    poz += elem;
    elem++;
  }
  cout << n - poz + 1;
  return 0;
}
