from math import log2
from random import randint,choice
def everyStep(n):
half =n/2
m=1
possible=[]
while True:
rest =2**m-1
if rest>=n:
break
if rest >=half:
possible.append(n-rest)
m=m+1
if possible:
return choice(possible)
def smartNimuGame(n):
while n>1:
print("".format(n))
while True:
try:
num=int(input('')) assert 1 <=num <=n//2
break
except:
print(''.format(n//2))
n-=everyStep(n)
else:
return ''
print(smartNimuGame(randint(1,100)))