#include <bits/stdc++.h>
using namespace std;
long long sum;
long long x;
int main() {
  int p = 0;
  cin >> x;
  x = abs(x);
  while (sum + p <= x) sum += p++;
  p--;
  if (sum == x)
    cout << p << endl;
  else if (p & 1) {
    int tmp = x - (p + 1) * p / 2;
    if (tmp & 1)
      cout << p + 2 << endl;
    else
      cout << p + 1 << endl;
  } else {
    int tmp = x - (p + 1) * p / 2;
    if (tmp & 1)
      cout << p + 1 << endl;
    else
      cout << p + 3 << endl;
  }
}
