#include <bits/stdc++.h>
using namespace std;
int const uu[4] = {1, -1, 0, 0};
int const vv[4] = {0, 0, 1, -1};
int const inf = 0x3f3f3f3f;
long long const INF = 0x7fffffffffffffffll;
double eps = 1e-10;
double pi = acos(-1.0);
long long x, d;
int main() {
  cin >> x;
  if (x == 0) {
    puts("0");
    return 0;
  }
  if (x < 0) {
    x = -x;
  }
  d = 1;
  while (d * (d + 1) / 2 < x) ++d;
  if (d * (d + 1) / 2 == x) {
    printf("%I64d\n", d);
  } else {
    long long x1 = d * (d + 1) / 2;
    long long deta = x1 - x;
    if (deta % 2 == 0) {
      printf("%I64d\n", d);
    } else {
      while (deta % 2 != 0) {
        ++d;
        x1 += d;
        deta = x1 - x;
      }
      printf("%I64d\n", d);
    }
  }
  return 0;
}
