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-----
7

-----Sample Output-----
4

4 can be divided by 2 twice, which is the most number of times among 1, 2, ..., 7.

Difficulty: EASY

Solutions:
N = int(input())
X = []
for i in range(1, N + 1):
	count = 0
	while i % 2 == 0:
		i //= 2
		count += 1
	X.append(count)
print(X.index(max(X)) + 1)


n = int(input())
s = 1
while n >= s:
	s *= 2
print(s // 2)


import sys

def solve(N: int):
	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)
	return

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	N = int(next(tokens))
	solve(N)

def __starting_point():
	main()
__starting_point()


n = int(input())
c = 0
for i in range(1, 8):
	if 2 ** i > n:
		print(2 ** (i - 1))
		break


import math
n = int(input())
ans = pow(2, int(math.log(n) / math.log(2)))
print(ans)


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


n = int(input())

class Solution:

	def __init__(self, n):
		self.n = n

	@staticmethod
	def answer():
		ans = 1
		current_zero_count = 0
		for i in range(1, n + 1):
			target_zero_count = list(map(int, bin(i)[2:])).count(0)
			if n == 1:
				break
			elif target_zero_count > current_zero_count:
				current_zero_count = target_zero_count
				ans = i
		print(ans)
conditions = Solution(n)
conditions.answer()


n = int(input())
(ans, cnt) = (1, 0)
for i in range(1, n + 1):
	j = i
	t_cnt = 0
	if i % 2 == 0:
		while i % 2 == 0:
			i = i // 2
			t_cnt += 1
		if t_cnt >= cnt:
			ans = j
			cnt = t_cnt
print(ans)


N = int(input())

def rec(n):
	if n % 2 == 0:
		return rec(n / 2) + 1
	else:
		return 0
(m, c) = (0, 1)
for i in range(1, N + 1):
	if m < rec(i):
		m = rec(i)
		c = i
print(c)


N = int(input())
i = 0
while pow(2, i + 1) <= N:
	i += 1
print(pow(2, i))


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


N = int(input())
count_max = -1
OK = True
for i in range(N):
	count = 0
	a = N - i
	while a % 2 == 0:
		a = a // 2
		count += 1
		if count_max < count:
			count_max = count
	else:
		continue
if 2 ** count_max == 0.5:
	print(1)
else:
	print(2 ** count_max)


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


n = int(input())
maxCnt = 0
ans = 1
for i in range(1, n + 1, 1):
	tmpCnt = 0
	j = i
	while j % 2 == 0:
		j = j / 2
		tmpCnt += 1
	if maxCnt < tmpCnt:
		maxCnt = tmpCnt
		ans = i
print(ans)


N = int(input())
result = 0
num = 1
for i in range(7):
	if N >= num:
		result = num
	else:
		None
	num *= 2
print(result)


import math
n = int(input())
print(2 ** int(math.log(n, 2)))


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


N = int(input())
X = 1
while X <= N:
	X *= 2
print(X // 2)


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


n = int(input())
print(1 << len(str(bin(n))) - 3)


N = int(input())
N |= N >> 1
N |= N >> 2
N |= N >> 4
N |= N >> 8
print(N + 1 >> 1)


N = int(input())
print(2 ** (len(bin(N)[2:]) - 1))


from math import log2
N = int(input())
print(2 ** int(log2(N)))


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


print(sorted(range(1, int(input()) + 1), key=lambda x: x & -x)[-1])


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


n = int(input())
ans = 1
for i in range(1, 7):
	if 2 ** i <= n:
		ans = 2 ** i
print(ans)


def LI():
	return list(map(int, input().split()))

def I():
	return map(int, input().split())
mod = 10 ** 9 + 7

def main():
	n = int(input())
	cnt = 1
	while n >= cnt:
		ans = cnt
		cnt *= 2
	print(ans)

def __starting_point():
	main()
__starting_point()


print(1 << len(f'{int(input()):b}') - 1)


a = int(input())
b = 1
while b << 1 <= a:
	b = b << 1
print(b)


n = int(input())
(max_count, answer) = (0, 0)
for i in range(1, n + 1):
	num = i
	count = 0
	while num % 2 == 0:
		num = num // 2
		count += 1
	if count > max_count:
		(max_count, answer) = (count, i)
print(max(1, answer))


import math
a = int(input())
print(2 ** math.floor(math.log(a, 2)))


N = int(input())
a = 1
while a * 2 <= N:
	a *= 2
print(a)


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


N = int(input())
x = 1
while x * 2 <= N:
	x *= 2
print(x)


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


import math
N = int(input())
k = math.log2(N)
print(2 ** int(k))


print(2 ** len(bin(int(input()))) >> 3)


N = int(input())
c = 0
while N > 1:
	N = N // 2
	c += 1
print(2 ** c)


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)


n = int(input())
ans = 2
while n > ans:
	ans *= 2
if n < ans:
	ans //= 2
print(ans)


(n, x) = (int(input()), 1)
while n >= x:
	x *= 2
print(x // 2)


N = int(input())
ans = 1
prev = 0
for i in range(1, N + 1):
	count = 0
	tmp = i
	while i % 2 == 0 and 1 < i:
		count += 1
		i /= 2
	if prev < count:
		prev = count
		ans = tmp
print(ans)


N = int(input())
A = 1
while A <= N:
	A *= 2
print(A // 2)


n = int(input())
ans = 1
x = 0
for i in range(1, n + 1):
	counter = 0
	r = 0 + i
	while r % 2 == 0:
		r //= 2
		counter += 1
	if x < counter:
		ans = i
		x = counter
print(ans)


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


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


N = int(input())
div = 1
while div * 2 <= N:
	div *= 2
print(div)


print(1 << int(input()).bit_length() - 1)


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


N = int(input())
ct = 0
while N > 1:
	N = N // 2
	ct += 1
print(2 ** ct)


s = int(input())
a = 1
while a * 2 <= s:
	a *= 2
print(a)


from itertools import count
n = int(input())
for i in count(0):
	if n < 2 ** (i + 1):
		print(2 ** i)
		break


print(2 ** len(bin(int(input()))) // 8)


n = int(input())
for i in range(1, 10):
	if 2 ** i > n:
		print(2 ** (i - 1))
		break


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


N = int(input())
ans = 0
res = 1
for i in range(2, N + 1):
	j = i
	if j % 2 == 1:
		continue
	cnt = 0
	while j % 2 == 0:
		j //= 2
		cnt += 1
	if ans < cnt:
		res = i
		ans = cnt
print(res)


n = int(input())
i = 0
while pow(2, i + 1) <= n:
	i += 1
print(pow(2, i))


N = int(input())
bi_N = bin(N)
tmp = len(bi_N) - 3
print(2 ** tmp)


import sys
sys.setrecursionlimit(250000)

def main():
	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(n)
main()


n = int(open(0).read())
print(2 ** (n.bit_length() - 1))


N = int(input())
lis = [0] * (N + 1)
Mcnt = 0
Mi = 1
for i in range(1, N + 1):
	lis[i] = i
	cnt = 0
	while lis[i] % 2 == 0:
		lis[i] //= 2
		cnt += 1
	if Mcnt < cnt:
		Mcnt = cnt
		Mi = i
print(Mi)


n = int(input())
b = len(bin(n))
print(2 ** (b - 3))


n = int(input())
s = format(n, 'b')
print(2 ** (len(s) - 1))


N = int(input())
exp = N.bit_length() - 1
print(2 ** exp)


n = int(input())
num = [i for i in range(1, n + 1)]
jou = [2 ** j for j in range(0, 7)]
for l in jou:
	if l in num:
		ans = l
	else:
		break
print(ans)


n = int(input())
print(1 << n.bit_length() - 1)


from math import log2
n = int(input())
print(2 ** int(log2(n)))


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


import math
n = int(input())
x = int(math.log2(n))
print(2 ** x)


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


N = int(input())
count = 0
while N > 1:
	N //= 2
	count += 1
print(2 ** count)


n = int(input())
res = 1
while True:
	if res > n:
		break
	res *= 2
print(res // 2)


import math as mt
n = int(input())
print(2 ** int(mt.log2(n)))


def dev2(a):
	ans = 0
	while a % 2 == 0:
		ans += 1
		a /= 2
		if a == 0:
			break
	return ans
n = int(input())
ans = 0
ans_num = 0
for i in range(1, n + 1):
	if ans < dev2(i):
		ans_num = i
		ans = dev2(i)
print(1 if n == 1 else ans_num)


import math
N = int(input())
print(2 ** math.floor(math.log2(N)))


import math

def fact(N):
	ans = {}
	for i in range(2, math.ceil(math.sqrt(N)) + 1):
		if N % i != 0:
			continue
		ex = 0
		while N % i == 0:
			ex += 1
			N /= i
		ans[i] = ex
	if N != 1:
		ans[int(N)] = 1
	return ans
N = int(input())
max_x = 0
max_n = 0
if N == 1:
	print(1)
	return
for i in range(N + 1):
	num = fact(i)
	num = num.get(2, 0)
	if num > max_n:
		max_x = i
		max_n = num
print(max_x)


N = int(input())
counter = 0
while N >= 2:
	N //= 2
	counter += 1
ans = 2 ** counter
print(ans)


N = int(input())
k = 1
while k * 2 <= N:
	k *= 2
print(k)


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


n = int(input())
print(2 ** (len(bin(n + (n > 1 > n & ~-n))) - 3))


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


n = int(input())
ans = 0
for i in range(n):
	if 2 ** i <= n:
		ans = 2 ** i
	else:
		break
print(ans)


import math
n = int(input())
a = int(math.log2(n))
print(2 ** a)


n = int(input())
max_count = 0
ans = 1
for i in range(1, n + 1):
	num = i
	count = 0
	while num % 2 == 0:
		num //= 2
		count += 1
	if count > max_count:
		ans = i
		max_count = count
print(ans)


N = int(input())
s = 1
while s <= N:
	s *= 2
print(s // 2)


N = int(input())
L = [64, 32, 16, 8, 4, 2]
for i in L:
	if i <= N:
		print(i)
		break
else:
	print(N)


n = int(input())
x = 0
for i in range(1, n + 1):
	if i % 64 == 0 and 64 > x:
		ans = i
		x = 64
	elif i % 32 == 0 and 32 > x:
		ans = i
		x = 32
	elif i % 16 == 0 and 16 > x:
		ans = i
		x = 16
	elif i % 8 == 0 and 8 > x:
		ans = i
		x = 8
	elif i % 4 == 0 and 4 > x:
		ans = i
		x = 4
	elif i % 2 == 0 and 2 > x:
		ans = i
		x = 2
	elif i == 1:
		ans = 1
		x = 1
print(ans)


N = int(input())
two = [2 ** i for i in range(7)]
ans = max([x for (i, x) in enumerate(two) if x <= N])
print(ans)


def cnt_div_two(n):
	res = 0
	while n % 2 == 0:
		n //= 2
		res += 1
	return res
ans = 0
max_cnt = -1
for i in range(1, int(input()) + 1):
	cdt = cnt_div_two(i)
	if cdt > max_cnt:
		ans = i
		max_cnt = cdt
print(ans)


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


n = int(input())
ans = 1
current_zero_count = 0
for i in range(1, n + 1):
	target_zero_count = list(map(int, bin(i)[2:])).count(0)
	if n == 1:
		break
	elif target_zero_count > current_zero_count:
		current_zero_count = target_zero_count
		ans = i
print(ans)


print(2 ** (len(format(int(input()), 'b')) - 1))


N = int(input())
num = 1
while num <= N:
	num *= 2
print(num // 2)


N = int(input())
i = 0
while True:
	if 2 ** i > N:
		print(2 ** (i - 1))
		return
	i += 1


n = int(input())
cnt = 0
while n > 0:
	n = n // 2
	if n != 0:
		cnt += 1
print(2 ** cnt)


import math
N = int(input())
M = 2 ** int(math.log2(N))
print(M)


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


num = int(input())
power = 2 ** (len(bin(num)) - 3)
print(power)


n = int(input())
print([2 ** i for i in range(n) if 2 ** i <= n][-1])


print(1 << len(bin(int(input()))) - 3)


n = int(input())
t = 2
while n // t > 0:
	t *= 2
print(t // 2)


N = int(input())
cnt_list = []
for i in range(1, N + 1):
	cnt = 0
	while i >= 1:
		if i % 2 == 0:
			cnt += 1
			i = i / 2
		else:
			break
	cnt_list.append(cnt)
M = cnt_list.index(max(cnt_list))
print(M + 1)


import math
N = int(input())
i = 1
while i < N:
	i = i * 2
if i <= N:
	print(i)
else:
	print(math.floor(i / 2))


import math
n = int(input())
(ans, i) = (0, 1)
while ans <= n:
	ans = 2 ** i
	i += 1
print(ans // 2)


l = bin(int(input()))
s = len(l) - 3
print(pow(2, s))


n = int(input())
k = 0
while 1:
	if 2 ** k > n:
		break
	ans = 2 ** k
	k += 1
print(ans)


N = int(input())

def black_magic(n):
	d = {1: 1431655765, 2: 858993459, 4: 252645135, 8: 16711935, 16: 65535}
	n = (n & d[1]) + (n >> 1 & d[1])
	n = (n & d[2]) + (n >> 2 & d[2])
	n = (n & d[4]) + (n >> 4 & d[4])
	n = (n & d[8]) + (n >> 8 & d[8])
	n = (n & d[16]) + (n >> 16 & d[16])
	return n
while black_magic(N) - 1:
	N &= N - 1
print(N)


n = int(input())
ans = 0
answer = 1
for i in range(1, n + 1):
	cnt = 0
	num = i
	while num % 2 == 0:
		num //= 2
		cnt += 1
	if cnt > ans:
		answer = i
		ans = cnt
print(answer)


N = int(input())
ans = [1, 2, 4, 8, 16, 32, 64]
print(max(filter(lambda x: x <= N, ans)))


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


n = int(input())
if n == 1:
	print(1)
else:
	for i in range(1, 7):
		if 2 ** (7 - i) <= n:
			print(2 ** (7 - i))
			return


N = int(input())
k = len(bin(N)) - 3
print(2 ** k)


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

def __starting_point():
	main()
__starting_point()


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


N = int(input())
r = 1
while r <= N:
	r *= 2
print(int(r / 2))


N = int(input())
l = N.bit_length()
print(2 ** (l - 1))


n = int(input())
li = [2, 4, 8, 16, 32, 64]
import bisect
index = bisect.bisect(li, n) - 1
import sys
if index == -1:
	print(n)
	return
print(li[index])


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


N = int(input())
for i in range(100):
	x = 2 ** (100 - i)
	if x <= 64 and x <= N:
		ans = x
		break
	else:
		ans = N
print(ans)


def resolve():
	print(2 ** (len(bin(int(input()))) - 3))

def __starting_point():
	resolve()
__starting_point()


n = int(input())
a = n
m = 0
for i in range(n + 1):
	j = 1
	for h in range(i + 1):
		if i % 2 ** j != 0:
			if m < j - 1:
				m = j - 1
				a = i
			break
		j += 1
print(a)


n = int(input())
a = len(bin(n)) - 3
print(n >> a << a)


N = int(input())
ans_max = 0
ans = 1
for i in range(1, N + 1):
	cnt = 0
	moto_i = i
	while i % 2 == 0:
		cnt += 1
		if cnt > ans_max:
			ans = moto_i
		ans_max = max(ans_max, cnt)
		i //= 2
print(ans)


n = int(input())
count = [0] * n
for i in range(1, n + 1):
	num = i
	while num % 2 == 0:
		num //= 2
		count[i - 1] += 1
print(count.index(max(count)) + 1)


s = int(input())
t = 1
for i in range(1, 8, 1):
	if s >= 2 ** i:
		t = 2 ** i
print(t)


import math
N = int(input())
L = int(math.log(N, 2))
print(2 ** L)


from math import log2, floor
print(2 ** floor(log2(int(input()))))


N = int(input())
ans = []
for i in range(N):
	q = i + 1
	count = 0
	if q == 1:
		continue
	while True:
		if q % 2 != 0:
			break
		q = q // 2
		count += 1
	ans.append(count)
if len(ans) > 0:
	max_count = max(ans)
	print(ans.index(max_count) + 2)
else:
	print(1)


n = int(input())
s = [i for i in range(1, n + 1)]
counter = 0
while True:
	if len(s) == 1:
		print(1)
		break
	if len([i for i in s if i % 2 == 0]) == 1:
		s = [i for i in s if i % 2 == 0]
		print(int(s[0]) * 2 ** counter)
		break
	else:
		s = [i / 2 for i in s]
		counter += 1


n = int(input())
import math
i = int(math.log2(n))
print(2 ** i)


import math
N = int(input())
print(2 ** math.floor(math.log(N, 2)))


N = int(input())
N2 = N
a = []
for i in range(N):
	count = 0
	if i != 0:
		tmp = N
		while tmp % 2 == 0:
			tmp = tmp / 2
			count += 1
		N = N - 1
	a.append(count)
max_value = max(a)
ind = a.index(max_value)
if N2 == 1:
	print(1)
else:
	print(N2 - ind + 1)


N = int(input())
n = 0
print([2 ** i for i in range(N) if 2 ** i <= N][-1])


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


def solve(n):
	res = 0
	while n != 1:
		if n % 2 == 0:
			res += 1
			n /= 2
		else:
			break
	return res
n = int(input())
ans = 1
ans_max = 0
for i in range(1, n + 1):
	cnt = solve(i)
	if cnt > ans_max:
		ans_max = cnt
		ans = i
print(ans)


N = int(input())
c = 2
while N >= c:
	c = c * 2
print(c // 2)


N = int(input())
if N == 1:
	print(1)
elif 1 < N < 2 ** 2:
	print(2)
elif 2 ** 2 <= N < 2 ** 3:
	print(4)
elif 2 ** 3 <= N < 2 ** 4:
	print(8)
elif 2 ** 4 <= N < 2 ** 5:
	print(16)
elif 2 ** 5 <= N < 2 ** 6:
	print(32)
elif 2 ** 6 <= N:
	print(64)


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


N = int(input())
result = 64
while N >= 1:
	if N >= result:
		print(result)
		break
	result = int(result / 2)
else:
	print(result)


N = int(input())
ans = 64
while ans > N:
	ans = ans / 2
print(int(ans))


import math
print(1 << int(math.log2(int(input()))))


n = int(input())
ans = 0
for i in range(n):
	if 2 ** i <= n:
		ans = max(ans, 2 ** i)
print(ans)


N = int(input())
l = len(bin(N)) - 3
print(2 ** l)


n = int(input())
i = 1
while i < n:
	i = i * 2
if i > n:
	print(int(i / 2))
else:
	print(i)


import math
N = int(input())
print(pow(2, int(math.log2(N))))


N = int(input())
for i in range(7):
	if 2 ** i <= N < 2 ** (i + 1):
		print(2 ** i)
		return


import math
n = int(input())
print(2 ** math.floor(math.log2(n)))


n = int(input())
m = 0
i = 0
while 2 ** i <= n:
	m = max(m, 2 ** i)
	i += 1
print(m)


import bisect
n = int(input())
t = [1, 2, 4, 8, 16, 32, 64]
print(t[bisect.bisect_right(t, n) - 1])


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


N = int(input())
print(1 << N.bit_length() - 1)


from math import gcd
from itertools import combinations, permutations, accumulate, product
from collections import deque, defaultdict, Counter
import decimal
import re
import math
import bisect
import heapq
import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7
INF = float('inf')
from sys import stdin
readline = stdin.readline

def readInts():
	return list(map(int, readline().split()))

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())
n = I()
lis = [2 ** i for i in range(10)]
idx = bisect.bisect_right(lis, n)
print(lis[idx - 1])


n = int(input())
l = len(bin(n)) - 2
print(2 ** (l - 1))


n_b = bin(int(input()))[::-1]
print(2 ** (n_b.index('b') - 1))


N = int(input())
res = 1
while res <= N // 2:
	res *= 2
print(res)


N = int(input())
cnt = 0
while 2 ** cnt <= N:
	cnt += 1
cnt -= 1
print(2 ** cnt)


n = format(int(input()), 'b')
print(int('1'.ljust(len(n), '0'), 2))


n = int(input())
a = 64
while a > n:
	a = a // 2
print(a)


from math import log2
N = int(input())
m = 0
a = 0
for i in range(1, N + 1):
	l = log2(i)
	if l % 1 == 0:
		m = i
print(m)


N = int(input())
print(max((2 ** i if 2 ** i <= N else 0 for i in range(10))))


n = int(input())
print(max((2 ** i for i in range(8) if 2 ** i <= n)))


import math

def answer(n: int) -> int:
	return 2 ** int(math.log(n, 2))

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

def __starting_point():
	main()
__starting_point()