def step(): def step_a(_p, _ms): return _p + 2, _ms + 2 def step_b(_p, _ms): return _p - 1, _ms + 1 pos, moved = (0, 0); yield pos, moved while True: pos, moved = step_a(pos, moved); yield pos, moved pos, moved = step_a(pos, moved); yield pos, moved pos, moved = step_b(pos, moved); yield pos, moved pos, moved = step_b(pos, moved); yield pos, moved pos, moved = step_a(pos, moved); yield pos, moved pos, moved = step_b(pos, moved); yield pos, moved pos, moved = step_b(pos, moved); yield pos, moved x = int(input()) for (pos, moved) in step(): if pos == x: print(moved) break