#include <bits/stdc++.h>
using namespace std;
const int DMAX = 100000 + 5;
const int MOD = 1000000000 + 7;
template <class T>
inline void read(T &x) {
  x = 0;
  T f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') {
      f = -1;
    }
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  x *= f;
}
long long n;
long long ans = 0;
long long diff = 0;
long long add = 1, pos = 0;
int main() {
  read(n);
  n = abs(n);
  if (n == 0) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 1; !ans; i++, add += i) {
    if (add == n || (add > n && (add - n) % 2 == 0)) {
      ans = i;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
