The ? 1 ? 2 ? ... ? n = k problem 

The problem

Given the following formula, one can set operators '+' or '-' instead of each '?', in order to obtain a given k
? 1 ? 2 ? ... ? n = k

For example: to obtain k = 12 , the expression to be used will be:
- 1 + 2 + 3 + 4 + 5 + 6 - 7 = 12
with n = 7

The Input

Input contains integer k (0<=|k|<=1000000000).

The Output

Your program should print the minimal possible n (1<=n) to obtain k with the above formula

Sample Input 1

12

Sample Output 1

7

Sample Input 2

-3646397

Sample Output 2

2701

Alex Gevak
September 15, 2000 (Revised 4-10-00, Antonio Sanchez)