#include <bits/stdc++.h>
using namespace std;
long long binaryLowerBound(long long n) {
  if (n == 0) return 0;
  long long first = 0;
  long long end = n;
  while (first <= end) {
    long long mid = (first + end) / 2;
    long long value = mid * (mid + 1) / 2;
    if (value == n) {
      return mid;
    } else if (value < n) {
      first = mid + 1;
    } else {
      end = mid - 1;
    }
  }
  return first - 1;
}
int main() {
  long long p;
  cin >> p;
  p = abs(p);
  long long n = binaryLowerBound(p);
  if (p == 0) {
    cout << 0 << endl;
  } else if (p == (n * (n + 1) / 2)) {
    cout << n << endl;
  } else {
    int temp = n + 1;
    while (true) {
      if ((int)abs((temp * (temp + 1) / 2) - p) % 2 == 0) {
        cout << temp << endl;
        break;
      }
      temp++;
    }
  }
}
