IntermediateRating 1400
Reach the Number
You start at 0 on a number line. On move i you step exactly i units left or right. Print the fewest moves needed to land exactly on t.
Input
One integer t (−10⁹ ≤ t ≤ 10⁹).
Output
One integer.
Sample 1
Input
2
Output
3
Sample 2
Input
3
Output
2
Output appears here