#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream& operator>>(istream& h, vector<T>& od) {
  for (int i = 0; i < od.size(); ++i) h >> od[i];
  return h;
}
template <typename T>
ostream& operator<<(ostream& h, vector<T>& od) {
  for (int i = 0; i < od.size(); ++i) h << od[i];
  return h;
}
template <typename T>
T qrt(T x) {
  return x * x;
}
int main() {
  int long long n;
  cin >> n;
  --n;
  int y = 1;
  while (n >= 0) {
    n -= y;
    ++y;
  }
  cout << n + y << endl;
}
