X = int(input()) move = [2, 2, -1, -1, 2, -1, -1] i = 0 now = 0 dist = 0 while now!=X: now += move[i] dist += abs(move[i]) i += 1 i %= len(move) print(dist)