x = int(input()) ans = [-1] * 15 pos = 0 t = 0 cnt = 0 lst = [2, 2, -1, -1, 2, -1, -1] while 1: try: if ans[pos] == -1: ans[pos] = cnt except: break cnt += abs(lst[t]) pos += lst[t] t += 1 if t == 7: t = 0 print(ans[x])