T = [2,2,-1,-1,2,-1,-1] X = int(input()) pos = 0 dist = 0 ind = 0 while X != pos: pos += T[ind] dist += abs(T[ind]) ind = (ind + 1) % len(T) print(dist)