import sys
data=sys.stdin.readlines()

meta=[]
def r(l):
    global meta
    meta=[]
    if len(l)>1:
        for i in range(1,len(l),2):
            meta.append(l[i])
    if len(meta)>1:
        r(meta)

for i in range(len(data)):
    data[i]=int(data[i])
for item in data:
    l=[]
    for i in range(item+1):
        l.append(i)
    r(l)
    print(meta[0])