#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x;
  cin >> x;
  if (!x)
    cout << 0 << endl;
  else {
    if (x < 0) x = -1 * x;
    long long ans = 1, temp = 0;
    while (temp < x) {
      temp = temp + ans;
      ans++;
    }
    ans--;
    long long res = ans * (ans + 1) / 2 - x;
    if (!res)
      cout << ans << endl;
    else if (res % 2) {
      if (ans % 2) ans++;
      cout << ans + 1 << endl;
    } else
      cout << ans << endl;
  }
  return 0;
}
