#include <bits/stdc++.h>
using namespace std;
class wwj {
 public:
  wwj(int x);
  int klz();
  int pdly(int k);

 private:
  int x;
};
wwj::wwj(int x) { this->x = x; }
int wwj::klz() {
  int i, sum = 0;
  double SM = 0;
  if (x == 0) return 0;
  SM = (-1 + sqrt(1.0 + 8 * abs(x))) / 2;
  if (int(SM) == SM)
    i = int(SM);
  else
    i = int(SM + 1);
  while (1) {
    if (pdly(i))
      return i;
    else
      ++i;
  }
}
int wwj::pdly(int k) {
  int s;
  s = k * (1 + k) / 2;
  x = abs(x);
  if (x % 2 == s % 2) return 1;
  return 0;
}
int main() {
  int x;
  cin >> x;
  wwj LR(x);
  cout << LR.klz() << endl;
  ;
}
