Problem:
 Score : 200 points    Problem Statement Takahashi loves numbers divisible by 2 .  You are given a positive integer N . Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.  Here, the number of times an integer can be divisible by 2 , is how many times the integer can be divided by 2 without remainder.  For example,   6 can be divided by 2 once: 6 -> 3 .  8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1 .  3 can be divided by 2 zero times.       Constraints  1 ≤ N ≤ 100         Input Input is given from Standard Input in the following format:  N       Output Print the answer.        Sample Input 1 7      Sample Output 1 4  4 can be divided by 2 twice, which is the most number of times among 1 , 2 , ..., 7 .       Sample Input 2 32      Sample Output 2 32       Sample Input 3 1      Sample Output 3 1       Sample Input 4 100      Sample Output 4 64

Solution (Python):


def main():
    n = int(input())

    max_cnt = 0
    max_num = 1
    for i in range(n, 0, -1):
        num = i
        cnt = 0
        while num % 2 == 0:
            cnt += 1
            num /= 2
        if max_cnt < cnt:
            max_cnt = cnt
            max_num = i
    print(max_num)

if __name__ == '__main__':
    main()

Solution (Python):
from math import log
print(2**int(log(int(input()))/log(2)))

Solution (Python):
n=int(input())
res=0
while n!=1:
  res += 1
  n >>= 1
print(2**res)

Solution (Python):
n = int(input())
i = 1
while 2 ** i <= n:
    i += 1
print(2 ** (i-1))

Solution (Python):
n = int(input())
l = list()

for i in range(10):
    l.append(2**i)

for i in range(10):
    if n - l[i] < 0:
        print(l[i-1])
        break

Solution (Python):
def two_count(num):
    count = 0
    while num % 2 == 0:
        count += 1
        num //= 2
    return count

n = int(input())

n_two_count = [two_count(n_i) for n_i in range(1, n+1)]
print(n_two_count.index(max(n_two_count))+1)

Solution (Python):
N = int(input())
a = 1
for i in range(7):
  if (2 ** i) > N:
    break
  a = (2 ** i)

print(a)

Solution (Python):
N = int(input())

binary = [2,4,8,16,32,64]

if N == 1:
  print(1)
else:
  for i in range(len(binary)):
    if binary[len(binary) - 1 - i] <= N:
      print(binary[len(binary) - 1 - i])
      break

Solution (Python):
N = int(input())
t = 1;
while(t * 2 <= N):
    t *= 2
print(t)

Solution (Python):
N = int(input())
max_count = 0
for i in range(2, N + 1):
    count = 0
    while i % 2 == 0:
        count += 1
        i //= 2
    max_count = max(max_count, count)

print(2**max_count)

Solution (Python):
N = int(input())
n = 1
while n * 2 <= N:
  n *= 2
print(n)

Solution (Python):
n = int(input())
a = []
for i in range(7):
  a.append(2**i)
for i in range(7):
  if n>=a[i]:
    ans=a[i]
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N + 1):
	temp = i
	count = 0
	while temp % 2 == 0:
		temp /= 2
		count += 1
	ans = max(ans, pow(2, count))
print(ans)

Solution (Python):
N = int(input())
s = 0
for i in range(1, N + 1):
	x = 0
	y = i
	while True:
		if y % 2 == 0:
			x += 1
			y = int(y // 2)
		else:
			break
	if x > s:
		s = x
print(2 ** s)

Solution (Python):
n=int(input())

if n<2:
  print(1)
elif n<4:
  print(2)
elif n<8:
  print(4)
elif n<16:
  print(8)
elif n<32:
  print(16)
elif n<64:
  print(32)
else:
  print(64)

Solution (Python):
n=int(input())
l=[]
a=1
while a<n+1:
    cnt=0
    tmp=a
    while tmp%2==0:
        tmp//=2
        cnt+=1
    a+=1
    l.append(cnt)
print(l.index(max(l))+1)

Solution (Python):
import math

print(2 ** int(math.log2(int(input()))))

Solution (Python):
"""
https://abc068.contest.atcoder.jp/tasks/abc068_b
"""
a=1
n=int(input())
while a<=n:
    a=a*2
print(int(a/2))

Solution (Python):
N = int(input())
cnt = 1
for i in range(1,N + 1):
    if 2 * cnt <= N:
        cnt *= 2
print(cnt)

Solution (Python):
import math;print(2**int(math.log2(int(input()))))

Solution (Python):


N = int(input())

cnt = 1
while True:
    if 2 ** cnt > N:
        print(2 ** (cnt - 1))
        exit()
    cnt += 1

Solution (Python):
N=int(input())
if N <=2:
    print(N)
elif N <4:
    print(2)
elif N <8:
    print(4)
elif N < 16:
    print(8)
elif N < 32:
    print(16)
elif N < 64:
    print(32)
else:
    print(64)

Solution (Python):

N = int(input())

a = 0
ans = 1

for i in range(N + 1):
    j = i
    temp = 0
    while j:
        if j % 2 == 0:
            temp += 1
            j = j // 2
        else:
            break
    if temp > a:
        a = temp
        ans = i

print(ans)

Solution (Python):
N = int(input())
for i in [64,32,16,8,4,2,1]:
    if N >= i:
        print(i)
        break

Solution (Python):
N = int(input())
ans = 1
while ans*2 <= N:
    ans *= 2
print(ans)

Solution (Python):
N=int(raw_input())
x=1
while x*2 <= N:
  x *= 2
print x

Solution (Python):
N = int(input())
count = 0
result = 0

if N == 1:
    print (1)
else:
    for i in range(1, N+1):
        now_count = bin(i)[::-1].index("1")
        if now_count > count:
            count = now_count
            result = i
    print(result)

Solution (Python):
N = int(input())

res = 1
while res <= N:
    res *= 2

print(int(res/2))

Solution (Python):


n = int(input())
ans = 1
while ans*2 <= n:
    ans *= 2
print(ans)

Solution (Python):
N = int(input())
for i in range(6,-1,-1):
    if N >= 2 ** i:
        print(2**i)
        break

Solution (Python):
N = int(input())
x = [2**i for i in range(7)]
for n in range(N, 0, -1):
    if n in x:
        print(n)
        exit()

Solution (Python):
n = int(input())
if n>=64:
    print('64')
elif n >= 32:
    print('32')
elif n >= 16:
    print('16')
elif n >= 8:
    print('8')
elif n >=4:
    print('4')
elif n >= 2:
    print('2')
else :
    print('{}'.format(n))

Solution (Python):
N = int(input())
answer = 1
while 1:
    answer *= 2
    if answer > N:
        answer /= 2
        break
print(int(answer))

Solution (Python):
N = int(input())

two = 1

while True:
    if two>N:
        break
    two = two*2
    
print(int(two/2))

Solution (Python):
def cal(data):
	res = 0
	num = data
	while True:
		if(num%2==0):
			res += 1
			num /= 2
		else:
			return res

def main():
	n = int(input())
	maxe = 0 
	res = 0;
	for i in range(1,n+1):
		if(cal(i)>=maxe): 
			maxe = cal(i) 
			res = i 
	print(res)

if(__name__ == '__main__'):
	main()

Solution (Python):
n = int(input())
ans = 0
while(n>=2):
    n = n // 2
    ans += 1
print(2**ans)

Solution (Python):
a=int(input())
k=0
x=0
while x<=a:
  x=2**k
  k+=1
print(int(x/2))

Solution (Python):
n = 101
rec = [0] * 101
num = 0
q = 1
for i in range(n):
    if i % 2 == 0:
        k = 0
        p = i
        while p % 2 == 0 and p > 1:
            p //= 2
            k += 1
        if k > num:
            num = k
            q = i
    rec[i] = q

print(rec[int(input())])

Solution (Python):
i = [1,2,4,8,16,32,64,128]
k = int(input())
 
for p in range(len(i)):
  if k == 1:
    print(1)
    break
  elif k < i[p]:
    print(i[p-1])
    break

Solution (Python):
n = int(input())
lst = [1,2,4,8,16,32,64,128]

for i in range(len(lst)):
    if n < lst[i]:
        print(lst[i-1])
        break

Solution (Python):
n = int(input())
x = 1
for i in range(10):
    if x > n:
        print(x//2)
        exit()
    else:
        x *= 2

Solution (Python):
N = int(input())
power = [2,4,8,16,32,64]
if N < 2: print(N)
else: print(max([i for i in power if i <= N]))

Solution (Python):
n = int(input())
counter = 0
    
while n != 1:
    n=int(n/2)
    counter += 1
    
print(2**counter)

Solution (Python):
n = int(input())
i = 1
while (i * 2 <= n):
  i *= 2
print(i)

Solution (Python):
N = int(input())
print(2**(len("{0:b}".format(N))-1))

Solution (Python):
n = int(input())

max_cnt, max_num = 0, 1
for i in range(1, n+1):
    cnt, a = 0, i

    while a%2 == 0:
        a //= 2
        cnt += 1

    if cnt > max_cnt:
        max_cnt = cnt
        max_num = i

print(max_num)

Solution (Python):
N=int(input())

if N==1:
  print(1)
else:
  cnt=2
  while cnt<=N:
    if cnt*2 > N:
      break
    else:
      cnt*=2
  print(cnt)

Solution (Python):
n = int(input())
a = 1

for i in range(n):
    if a <= n:
        a = a*2
    else:
        break

print(int(a/2))

Solution (Python):
n= int(input())
ans=0
while(n>=2**ans):
    ans+=1
print(2**(ans-1))

Solution (Python):
x = int(input())
max_num = 0
max_count = 0

for i in range(1, x+1):
    count = 0
    flag =1
    num = i
    while flag==1:
        if num%2 == 0:
            count = count+1
            num = num/2
            continue
        else:
            flag=0
            if count>=max_count:
                max_num = i
                max_count = count
                break
            else:
                break

print(max_num)

Solution (Python):
N = int(input())
if N >= 64:
    print(64)
elif 64 > N >= 32:
    print(32)
elif 32 > N >= 16:
    print(16)
elif 16 > N >= 8:
    print(8)
elif 8 > N >= 4:
    print(4)
elif 4 > N >= 2:
    print(2)
elif 2 > N >= 1:
    print(1)

Solution (Python):
N = int(input())

now = 1
while(True):
    if now>N:
        print(now//2)
        break
    else:
        now *= 2

Solution (Python):
n=int(input())
l=[1,2,4,8,16,32,64]
for i in l[::-1]:
    if n//i>0:
        print(i)
        break

Solution (Python):
N = int(input())

l = [64, 32, 16, 8, 4, 2, 1]

for i in l:
    if i in range(N + 1):
        print(i)
        break

Solution (Python):
n = int(input())
k = 1
while k*2<=n: k *= 2
print(k)

Solution (Python):
def count_div(n):
    c = 0
    while n % 2 == 0 and n > 1:
        c += 1
        n = n / 2
    return c


if __name__ == '__main__':
    maximum = (0, 0)
    for i in range(int(input()), 0, -1):
        current = count_div(i)
        if current >= maximum[0]:
            maximum = (current, i)
    print(maximum[1])

Solution (Python):
N = int(input())
for i in range(7):
    if 2**(6-i) <=N:
        print(2**(6-i))
        break
    else:
        pass

Solution (Python):
n = int(input())

def n2(n):
    counter = 0
    while n % 2 == 0:
        n = n / 2
        counter += 1
    return counter

max_resistor = 0
max_n2 = 0
for i in range(1,n+1):
    i_n2 = n2(i)
    if max_n2 <= i_n2:
        max_n2 = i_n2
        max_resistor = i
    
print(max_resistor)

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ni()
ans = [0]*n
for i in range(1,n+1):
    ind = i - 1
    while True:
        r = i % 2
        if r == 0:
            ans[ind] += 1
            i = i // 2
        else:
            break

print(ans.index(max(ans)) + 1)

Solution (Python):
n = int(input())
k = 1
while k * 2 <= n: k *= 2
print(k)

Solution (Python):
N = int(input())
ans = []

if N == 1:
    print(1)
    exit()

for num in range(2, N + 1, 2): 
    current = 0
    while True:
        if num % 2 == 0:
            current += 1
            num /= 2
        else:
            break
    ans.append(current)

print((ans.index(max(ans)) + 1) * 2)

Solution (Python):
n = int(input())
p = 1
while (2 ** p) <= n:
    p += 1
print(2 ** (p - 1))

Solution (Python):
N = int(input())
ans = 1
while ans <= N:
    ans *= 2
print(int(ans/2))

Solution (Python):
n = int(input())
two = [1,2,4,8,16,32,64,]
for x in range(1, n+1):
    if x in two:
        hold = x
print(hold)

Solution (Python):
import math
import sys

def getinputdata():

    
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])


maxdata=0


seq=1

for v in range(1,1+n):
    

    
    vtemp=v
    cnt=0
    while(vtemp%2==0):

    
        cnt+=1

        vtemp=vtemp/2
    
    else:   
        

        if maxdata<cnt:

            maxdata=cnt
            seq=v

        

print(seq)

Solution (Python):
n = int(input())
x = [64,32,16,8,4,2,1]
for i in x:
  if i<=n:
    print(i)
    break

Solution (Python):
import math
print(1<<int(math.log2(int(input()))))

Solution (Python):





if __name__ == '__main__':
    number = int(input())

    count = 0

    while 2 ** count <= number:
        count += 1

    print(2 ** (count - 1))

Solution (Python):
N = int(input())
N2 = [64,32,16,8,4,2,1]
for i in range(len(N2)):
	if N2[i] <=N:
		print(N2[i])
		break

Solution (Python):

n = int(input())
for i in range(8):
    if 2**(i+1)>n:
        print(2**i)
        break

Solution (Python):
n = int(input())
k = 0
while 2**k <= n:
    k += 1
print(2**(k-1))

Solution (Python):
L=[1,2,4,8,16,32,64]
l=0
N=int(input())
while l < len(L):
    if N < L[l]:
        print(L[l-1])
        break
    else:
        l += 1
if l == len(L):
    print(L[-1])

Solution (Python):
from math import log2
i = int(input())
j = sorted([2 ** x for x in range(7)] + [i])
if log2(i) % 1 == 0:
  print(i)
  exit()
print(j[j.index(i) - 1])

Solution (Python):
n=int(input())
ans=0
while 2**ans<=n:
	ans+=1
ans-=1
print(2**ans)

Solution (Python):
N = int(input())
n = 0
while N > 0:
    N = N//2
    n = n + 1
print(2**(n-1))

Solution (Python):
n = int(input())
if n == 1:
	print('1')
elif 2 <= n <= 3:
	print('2')
elif 4 <= n <= 7:
	print('4')
elif 8 <= n <= 15:
	print('8')
elif 16 <= n <= 31:
	print('16')
elif 32 <= n <= 63:
	print('32')
else:
	print('64')

Solution (Python):
n=int(input())

for i in range(n):
    if 2**i>n:
        print(2**(i-1))
        break
    elif 2**i==n:
        print(n)
        break

Solution (Python):
n=int(input())
k=0
while 2**k<=n:
    k+=1
print(2**(k-1))

Solution (Python):
N=int(input())
x=1
while(x<=N):
  x*=2
if(x>N):
  x/=2
print(int(x))

Solution (Python):
L = [1, 2, 4, 8, 16, 32, 64]
N = int(input())
print(max([n for n in L if n <= N]))

Solution (Python):
N = int(input())
x = 1

while x * 2 <= N:
    x *= 2
print(x)

Solution (Python):
n = int(input())

if n == 1:
  print(1)
elif n >= 2 and n <= 3:
  print(2)
elif n >= 4 and n <= 7:
  print(4)
elif n >= 8 and n <= 15:
  print(8)
elif n >= 16 and n <= 31:
  print(16)
elif n >=32 and n <= 63:
  print(32)
else:
  print(64)

Solution (Python):
N = int(input())
for i in range(7):
  if 2**i <= N and 2**(i+1) > N:
    print(2**i)
    break

Solution (Python):
N=int(input())

i=1
while(1):
    if 2**i>N:
        break
    i+=1

print(2**(i-1))

Solution (Python):
n = int(input())
if n >= 64:
  print("64")
elif n >= 32:
  print("32")
elif n >= 16:
  print("16")
elif n >= 8:
  print("8")
elif n >= 4:
  print("4")
elif n >= 2:
  print("2")
else:
  print("1")

Solution (Python):
n = int(input())
pow = n
ans = 0
while 2**pow > n:
    pow-=1
print(2**pow)

Solution (Python):
n = int(input())

hint = [1, 2, 4, 8, 16, 32, 64, 128]

def foo(n):
    last = 0
    for b in hint:
        if n < b:
            return last
        else:
            last = b
    return last


print(foo(n))

Solution (Python):
n = int(input())
c = []
cnt = 0

for i in range(1, n+1):
   while i%2 == 0:
      
      i = i/2
      cnt += 1
   c.append(cnt)
   cnt = 0

print(c.index(max(c))+1)

Solution (Python):
from math import log2
n=int(input())
for i in range(n,0,-1):
    if int(log2(i))==log2(i):
        print(i)
        quit()

Solution (Python):
n = int(input())
ans = 1
while ans <= n: ans *= 2
print(ans//2)

Solution (Python):

n = int(input())

def cnt(a):
    if a == 1:
        return 0
    return 1 + cnt(a//2)

res, maxcount = 0, -1
for a in range(1, n + 1):
    if maxcount < cnt(a):
        maxcount, res = cnt(a), a
print(res)

Solution (Python):
li=[2,4,8,16,32,64,128]
n=int(input())
if n<2:
    print(n)
    quit()
for i in li:
    if n<i:
        print(i//2)
        quit()

Solution (Python):
a = int(input())
l = 0
while a > 1:
  a = a>>1
  l += 1
print(2**l)

Solution (Python):
N = int(input())
n = 1
num = 2
while num <= N:
    num = 2**n
    n += 1
print(int(num/2))

Solution (Python):
n=int(input())
for i in range(1,9):
    if(2**(i-1)<=n and n<2**i):
        print(2**(i-1))
        exit()

Solution (Python):
n=int(input())
k=0
while 2**k<=n:
    k+=1
print(2**(k-1))

Solution (Python):
n=int(input())
i=0
array=[]
while 2**i<=n:
    array.append(2**i)
    i+=1
print(max(array))

Solution (Python):
print(2**(len(bin(int(input())))-3))

Solution (Python):
n = int(input())

ct = 0
while n//2 != 0:
    n = n//2
    ct += 1

print(2**ct)

Solution (Python):
n = int(input())
a = []

for i in range(1, n+1):
    if i % 2 == 0:
        a.append(a[i//2-1] + 1)
    else:
        a.append(1)

print(a.index(max(a))+1)

Solution (Python):
N = int(input())
a = 1
for i in range(N):
    if a > N:
        a = a // 2
        break
    if a == N:
        break
    else:
        a = a * 2
print(a)

Solution (Python):
N = int(input())
 
if N == 1:
    print(1)
else:
    ans = 2
    while ans * 2 <= N:
        ans *= 2
    print(ans)

Solution (Python):
n = int(input())

maxnum = 2

for i in range(8):
    if maxnum > n:
        print(int(maxnum/2))
        break
    maxnum*=2

Solution (Python):
n = int(input())

def find(n):
  result = []
  for i in range(1, n+1):
    count = 0
    while i // 2 >= 1:
      if i % 2 == 0:
        count += 1
      
      i = i // 2
    
    result.append(count)
  return result.index(max(result)) + 1

print(find(n))

Solution (Python):
N = int(input())

if N == 1:
	print(N)
	
else:
	a = 2
	while (1):
		if a*2 > N:
			break
		a *= 2
		
	print(a)

Solution (Python):
n = int(input())
if(n == 1):
    print(1)
else:
    a = 2
    while True:
        if(a * 2 > n):
            break
        a *= 2
    print(a)

Solution (Python):
if __name__ == "__main__":
    N = int(input())
    if N <= 1:
        print (1)
        exit()

    res_cnt = 0
    res = 0
    for x in range(N + 1):
        cnt = 0
        y = x
        while (y > 1):
            if y % 2 == 0:
                y //= 2
                cnt += 1
            else:
                break
        if cnt > res_cnt:
            res_cnt = cnt
            res = x
    print (res)

Solution (Python):
import sys

N = int(input())
l = list(range(1,7))
k = l[::-1]

if N == 1:
    print(1)
    sys.exit()

for i in k:
    if N >= (2**i):
        print(2**i)
        sys.exit()

Solution (Python):
N = input()

cnt=0

for i in range(N):
    if N!=1:
        N=N/2
        cnt+=1
    else:
        break
print 2**cnt

Solution (Python):
n = int(input())
top = n
top_count = 0
for i in range(n,0,-1):
    current = i
    count = 0
    while current % 2 == 0:
        current = current / 2
        count = count + 1
    if (count >= top_count):
        top_count = count
        top = i
    

print(top)

Solution (Python):
n = int(raw_input())
t = [1, 2, 4, 8, 16, 32, 64, 128]
i = 0
while t[i] <= n:
    i += 1
print t[i-1]

Solution (Python):
array = [2,4,8,16,32,64]

num = int(input())
while num not in array:
    if num == 1:
        break
    else:
        num -= 1
print(num)

Solution (Python):


import math

N=int(input())

print(2**int(math.log(N, 2)))

Solution (Python):
N = int(input())
maxv = 0
ans = 1
for i in range(N, 0, -1):
    if i % 2:
        continue
    tmp = 0
    tmpv = i
    while i % 2 == 0:
        tmp += 1
        i = i // 2
    if tmp > maxv:
        maxv = tmp
        ans = tmpv
print(ans)

Solution (Python):
n = input()
def get(n):
	cnt = 0
	while True:
		if not n % 2:
			n /= 2
			cnt += 1
		else:
			break
	return cnt
d = {}
for x in xrange(1, n + 1):
	d[x] = get(x)
max_v = sorted(d.values())[-1]
d = {v: k for k, v in d.iteritems()}
print d[max_v]

Solution (Python):
N = input()

saidai = 0

for i in range(1,int(N)+1):
    count = 0
    flag = 0
    x = i
    
    while flag == 0:
        y = int(int(x) % 2)
        if y == 0:
            count = int(int(count) + 1)
            x = int(int(x) / 2)
        elif y == 1:
            flag = 1

    if int(count) >= int(saidai):
        saidai = count
        z = i

print(z)

Solution (Python):
N = int(input())
ans = 1
while ans * 2 <= N:
    ans *= 2
print(ans)

Solution (Python):
N = int(raw_input())
ans = 64
while ans > N: ans /= 2
print ans

Solution (Python):
def solve():
    N = int(input())

    ans = 1
    while ans <= N:
        ans *= 2

    print(min(ans // 2, N))


solve()

Solution (Python):
N = int(input())
ret = 1
while ret * 2 <= N:
    ret *= 2

print(ret)

Solution (Python):
N = int(input())
l = [2**n for n in range(10) if 2**n <= N]
print(max(l))

Solution (Python):
n = int(input())
if n == 1:
    print(1)
    exit()

ans = [0] * 2
for i in range(1, n + 1):
    num = i
    cnt = 0
    while num % 2 == 0:
        num //= 2
        cnt += 1

    if cnt > ans[1]:
        ans[0] = i
        ans[1] = cnt

print(ans[0])

Solution (Python):
import math
n=int(input())

if n==1:
    print(1)
else:
    m=math.log2(n)
    ans=math.pow(2,math.floor(m))
    print(int(ans))

Solution (Python):
n = int(input())

x = 1
while(x*2 <= n):
    x *= 2

print(x)

Solution (Python):
n = int(input())

x, a = 1, None
for i in range(8):
    if x <= n:
        a = x
        x *= 2
    else:
        break

print(a)

Solution (Python):
n = int(input())

breakNum = 1

while breakNum*2 <= n:
	breakNum *= 2

print(breakNum)

Solution (Python):
N = int(input())
ans = 1
for i in range(N):
    t = 2 * ans
    if t > N:
        print(ans)
        break
    ans = t

Solution (Python):
n = int(input())
for i in range(7):
    if 2 ** i <= n < 2 ** (i+1):
        print(2 ** i)
        break

Solution (Python):

"""
http://abc068.contest.atcoder.jp/tasks/abc068_b
"""
from math import log

def solve(N):
    
    flp2 = 2 ** int(log(N, 2))
    return flp2


def main():
    N = int(input())
    result = solve(N)
    print(result)


if __name__ == '__main__':
    main()

Solution (Python):
import math 
s=int(input())
print(2**int(math.log2(s)))

Solution (Python):
from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


def count(n):
    ans = 0
    while n % 2 == 0:
        n //= 2
        ans += 1
    return ans


def main():
    N = int(input())
    ans, num = 0, 0
    for i in range(1, N + 1):
        if count(i) >= num:
            num = count(i)
            ans = i

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import math as m
s=int(input())
print(2**int(m.log2(s)))

Solution (Python):
ans = 1
n = int(input())
while n >= ans * 2:
  ans *= 2
print(ans)

Solution (Python):
ans = 1
n = int(input())
while True:
  if ans * 2 > n:
    print(ans)
    break
  ans *= 2

Solution (Python):
N=int(input())
x=[]
for i in range(200):
    x.append(0)
for i in range(200):
    ori=i
    while ori!=0:
        if ori%2==0:
            ori=ori/2
            x[i]+=1
        else:
            break
maxi=1
maxv=0
for i in range(200):
    if maxv<x[i] and i<N+1:
        maxv=x[i]
        maxi=i
print(maxi)

Solution (Python):
print(2**(len(str(bin(int(input()))))-3))

Solution (Python):
n = int(input())
c = 0

while n > 1:
    n //= 2
    c += 1

print(2**c)

Solution (Python):
import math
n = int(input())
k = math.floor(math.pow(2,math.floor(math.log(n,2))))
print(k)

Solution (Python):
n=int(input())
a=[2**x for x in range(7)]
a=a[::-1]
for x in a:
    if n>=x:
        ans=x
        break
print(ans)

Solution (Python):
a=int(input())
b=int(2)
c=int
if 1==a:
    print(a)
else:
    while b<100:
        c=b
        b=b*2
        
        if(a<b)and(a>=c):
            print (c)

Solution (Python):
x = input()
x = int(x)
y = 1
while x>=y:
    y = y*2
else:
    print(int(y/2))

Solution (Python):
N = int(input())

ans = 64
while N < ans:
    ans //= 2

print(ans)

Solution (Python):
N = int(input())

for i in range(10):
    if 2 ** i <= N < 2 ** (i+1):
        print(2**i)
        break

Solution (Python):
def main():
    tmp, ans = 2, 1
    for i in range(2, int(input())+1):
        if i % tmp == 0:
            ans = i
            tmp *= 2
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
x=int(input())
n=str(bin(x))
print(2**(len(n)-3))

Solution (Python):
N = int(input())

if N == 1:
    print(N)
else:
    for i in range(N):
        if 2**i > N:
            print(2**(i-1))
            break

Solution (Python):
import sys
N=int(input())
for i in range(8):
  if 2**i>N:
    print(2**(i-1))
    sys.exit()

Solution (Python):
N = int(input())
secound = [64,32,16,8,4,2,1]
for i in secound:
    if N >= i:
        print(i)
        break

Solution (Python):
N = input()

i = 1

while i <= N:
    i *= 2

print i / 2

Solution (Python):
a = int(input())
i = 1
while(i<=a):
	i *= 2
print(int(i/2))

Solution (Python):
def main(N):
    n_div_max = 0
    answer = 1
    for n in range(1, N + 1):
        _n = n
        tmp_n_div = 0
        while True:
            _n, m = divmod(_n, 2)
            if m > 0:
                break
            tmp_n_div += 1

        if tmp_n_div >= n_div_max:
            n_div_max = tmp_n_div
            answer = max(answer, n)

    print(answer)


def main2(N):
    
    for i in reversed(range(7)):
        n = 2 ** i
        if N >= n:
            print(n)
            return

if __name__ == '__main__':
    N = int(input())
    main2(N)

Solution (Python):
N = int(input())

for i in range(10):
    if N > 2**i:
        continue
    elif N < 2**i:
        break

print(2**(i-1))

Solution (Python):
n = int(input())
nums = [2**x for x in range(10)]
while True:
	if n in nums:
		print(n)
		break
	else:
		n -= 1

Solution (Python):
n=int(input())
max=-1
ans=1
for i in range(1,n+1):
	temp=i
	kount=0
	while temp%2==0:
		temp/=2
		kount+=1
	if kount>max:
		max=kount
		ans=i
print(ans)

Solution (Python):
n = int(input())
i=1
t=1
while(i <= n):
    t = i
    i *= 2
print(t)

Solution (Python):
n=int(input())
max=-1
ans=1
for i in range(1,n+1):
	temp=i
	kount=0
	while temp%2==0 :
		temp/=2
		kount+=1
	if kount>max:
		max=kount
		ans=i
print(ans)

Solution (Python):
number = int(input())
i = 1
while i <= number:
    i *= 2
print(int(i/2))

Solution (Python):
N = int(input())
i = 1
while i <= N:
    i *= 2
print(int(i/2))

Solution (Python):
N = int(input())
if N >= 64:
    print(64)
elif N >= 32:
    print(32)
elif N >= 16:
    print(16)
elif N >= 8:
    print(8)
elif N >= 4:
    print(4)
elif N >= 2:
    print(2)
else:
    print(1)

Solution (Python):
n = int(input())
i = 1
while i <= n:
    i *= 2
print(int(i/2))

Solution (Python):
n=int(input())
anser=1
while anser<=n:
    anser*=2
print(anser//2)

Solution (Python):
n=int(input())
a=1
while a*2<=n:
 a*=2
print(a)

Solution (Python):
n = int(input())
lst = [1, 2, 4, 8, 16, 32, 64]
lst.append(n)
lst.sort()
lst.reverse()
num = lst.index(n) + 1
print(lst[num])

Solution (Python):
N = int(input())
p = 0
while True:
    if N < 2**p:
        print(2**(p-1))
        break
    else:
        p=p+1

Solution (Python):
N = int(input())

li = [2**i for i in range(7)]

for i, x in enumerate(li, 1):
    if N >= li[len(li)-i]:
        print(li[len(li)-i])
        break
    else:
        continue

Solution (Python):


N = int(raw_input())

if N >= 64:
    print '64'
elif N >= 32:
    print '32'
elif N >= 16:
    print '16'
elif N >= 8:
    print '8'
elif N >= 4:
    print '4'
elif N >= 2:
    print '2'
else:
    print '1'

Solution (Python):
n = int(input())
i = 0
while 2 ** i <= n:
    i += 1
print(2 ** (i - 1))

Solution (Python):
n = int(input())
bi = [2 ** i for i in range(8)]
for i in range(8):
    if n < bi[i]:
        print(bi[i - 1])
        break

Solution (Python):
n = int(input())
count = 0
for i in range(1, n):
    if n >= pow(2, i):
        count = count + 1
    else:
        break
print(pow(2,count))

Solution (Python):
inp = int(input())
count = 0
serch = 1


for i in range(1,inp + 1):
	a = i
	j = 1
	while j <= i:
		if a % 2 != 0:
			if j - 1 > count:
				count = j - 1
				serch = i
			break
		a = a / 2
		j += 1


print(serch)

Solution (Python):
N = int(input())

tmp = 1
while(1):
    if tmp*2 > N:
        break
    else:
        tmp *= 2
        
print(tmp)

Solution (Python):
a = 100
l = [0]*a
t = 1
for x in xrange(a):
	while t%2 == 0:
		t = t/2
		l[x] += 1
	t = x+2
a = int(raw_input())
ma = 0
mi = 1
for x in range(a):
	if l[x] > ma:
		ma = l[x]
		mi = x
if a == 1:
	print(1)
else:
	print(mi+1)

Solution (Python):


import math

def check(n, i):
    if (2 ** i > n):
        return 2 ** (i-1)
    else:
        return check(n, i+1)

n = int(input())
print(check(n, 0))

Solution (Python):
N = int(raw_input())

S = range(N)
for i in S:
    S[i] = i + 1

res = []

for i in S:
    num = i
    count = 0

    while i%2 == 0:

        i = i/2
        count += 1

    res.append((count,num))


res.sort()

Anser = res[-1][1]

print Anser

Solution (Python):
x=int(input(""))
k=0
while True:
  if pow(2,k)>x:
    break
  k+=1
print(pow(2,k-1))

Solution (Python):
print(2**(len(bin(int(input())))-3))

Solution (Python):


num = int(input())

if num >= 64:
    print(str(64))
elif num >= 32:
    print(str(32))
elif num >= 16:
    print(str(16))
elif num >= 8:
    print(str(8))
elif num >= 4:
    print(str(4))
elif num >= 2:
    print(str(2))
else:
    print(str(1))

Solution (Python):
N = input()
ans = 1
while ans*2 <= N:
    ans *= 2
print ans

Solution (Python):
arr=[64,32,16,8,4,2,1]
n=int(input())
for i in arr:
    if n>=i:
        print(i)
        break

Solution (Python):
print(2**(len(bin(int(input()))[2:])-1))

Solution (Python):
print(2**(len(str(bin(int(input())))[2:])-1))

Solution (Python):
n = int(input())
i=1
while ( i * 2 <= n):
    i *= 2
print(i)

Solution (Python):
n = int(input().strip())
while True:
 if n & (n-1) == 0:
  print(n)
  break
 n -= 1

Solution (Python):
print(2**(len(str(int(str(bin(int(input())))[2:])))-1))

Solution (Python):


n = int(input())
for i in range(7, -1, -1):
    a = 2**i
    if n >= a:
        print(a)
        exit()

Solution (Python):

N = int(input())
a = [tmp for tmp in reversed(range(1,N+1)) if tmp%2 == 0]
ans = 0
for tmp in range(7):
    if N == 1:
        ans = 1
        break
    b = [tmp2//2 for tmp2 in a if tmp2%2 == 0]
    if len(b) != 0:
        ans += 1
    else:
        ans = (2**ans)*a.pop()
        break
    a = [tmp2 for tmp2 in b]
print(ans)

Solution (Python):
input_number = int(input())                                                                 
count = 0 
buff_rank = []

for i in range(1,input_number+1):
    num = i 
    while num % 2 == 0:
        num = num // 2
        count = count + 1 
    buff_rank.append(count)
    count = 0 

print(buff_rank.index(max(buff_rank))+1)

Solution (Python):



num = raw_input()
num = int(num)

i = 0
while 1:
    if 2**i <= num:
        i += 1
    else:
        break

ans = 2**(i - 1)

print ans

Solution (Python):
s = int(input())
ans = 0

while(s > 1):
    s = s//2
    ans += 1
    if s <= 1:
        break

print(2**ans)

Solution (Python):
import math
t=int(input())
x=0
i=0
while x<=t:
  x=math.pow(2,i)
  i+=1
print(int(pow(2,i-2)))

Solution (Python):


n = int(input())
i = 1
while i <8:
    if n < 2**i:
        print (2**(i-1))
        break
    else:
        i += 1

Solution (Python):
N = int(input())

k = [2 ** i for i in range(1, 8)]

M = 1

for i in k:
    if i <= N:
        M = i

print(M)

Solution (Python):
N = int(input())
arr = [i for i in range(1, N + 1)]

nums = N*[0]
for j in range(N):
    target = arr[j]
    num = 0
    while target % 2 == 0:
        num += 1
        target /= 2
    nums[j] = num



max = 0
for k in range(N):
    if nums[k] > max:
        max_index = k
        max = nums[k]
    elif N == 1:
        max_index=0
 
print(arr[max_index])