#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x, sum;
  while (~scanf("%lld", &x)) {
    if (x < 0) x = -x;
    if (x == 2)
      printf("3\n");
    else if (x == 0)
      printf("0\n");
    else {
      for (long long i = 1; i <= x; i++) {
        sum = i * (i + 1) / 2;
        if (sum == x || (sum > x && ((sum - x) % 2 == 0))) {
          printf("%d\n", i);
          break;
        }
      }
    }
  }
}
