#include <bits/stdc++.h>
using namespace std;
long long int myfind(long long int l, long long int h, long long int x) {
  long long int m, ans;
  while (l <= h) {
    m = ((h - l) >> 1) + l;
    if (((m * (m + 1)) >> 1) >= x) {
      ans = m;
      h = m - 1;
    } else
      l = m + 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int x, t, j, ans;
  cin >> x;
  x = abs(x);
  t = myfind(0ll, INT_MAX, x);
  j = (t * (t + 1)) >> 1;
  if ((j - x) & 1)
    ans = t + 2;
  else
    ans = t;
  j = ((t + 1) * (t + 2)) >> 1;
  if ((j - x) & 1)
    ans = min(ans, t + 3);
  else {
    if (((j - x) >> 1) < (t + 1)) ans = min(ans, t + 1);
  }
  cout << ans << endl;
  return 0;
}
