AtCoder Beginner Contest 081 - Shift only

There are N positive integers written on a blackboard: A_1, ..., A_N.
Snuke can perform the following operation when all integers on the blackboard are even:
 - Replace each integer X on the blackboard by X divided by 2.
Find the maximum possible number of operations that Snuke can perform.

-----Constraints-----
 - 1 \leq N \leq 200
 - 1 \leq A_i \leq 10^9

-----Input-----
Input is given from Standard Input in the following format:
N
A_1 A_2 ... A_N

-----Output-----
Print the maximum possible number of operations that Snuke can perform.

-----Sample Input-----
3
8 12 40

-----Sample Output-----
2

Initially, [8, 12, 40] are written on the blackboard.
Since all those integers are even, Snuke can perform the operation.
After the operation is performed once, [4, 6, 20] are written on the blackboard.
Since all those integers are again even, he can perform the operation.
After the operation is performed twice, [2, 3, 10] are written on the blackboard.
Now, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.
Thus, Snuke can perform the operation at most twice.

Source: atcoder | Difficulty: EASY


Solutions:
n = int(input())
a = list(map(int, input().split()))

def devide(a, c, n):
	even = True
	for i in range(n):
		if a[i] % 2 != 0:
			even = False
		else:
			a[i] = int(a[i] / 2)
	return devide(a, c + 1, n) if even else c
print(devide(a, 0, n))


N = int(input())
A = list(map(int, input().split()))
cnt = 0
flag = True
while flag:
	for i in range(N):
		if A[i] % 2 == 0:
			A[i] //= 2
		else:
			flag = False
			break
	else:
		cnt += 1
		continue
print(cnt)


n = int(input())
line = list(map(int, input().split()))
ans = 30
for i in range(n):
	count = 0
	x = line[i]
	while True:
		if x % 2 == 0:
			x = x // 2
			count += 1
		else:
			break
	if count < ans:
		ans = count
print(ans)


def main():
	n = int(input())
	a = list(map(int, input().split(' ')))
	ans = 0
	while True:
		for i in range(n):
			if a[i] % 2 != 0:
				return ans
			a[i] = a[i] // 2
		ans += 1
print(main())


N = int(input())
A = list(map(int, input().split()))
ans_list = []
for n in A:
	temp = n
	count = 0
	while temp % 2 == 0:
		temp /= 2
		count = count + 1
	ans_list.append(count)
print(min(ans_list))


int(input())
A = list(map(int, input().split()))
ans = 0
while all((a % 2 == 0 for a in A)):
	A = [a / 2 for a in A]
	ans += 1
print(ans)


input()
print(min([bin(int(i))[::-1].find('1') for i in input().split()]))


n = int(input())
a = [int(i) for i in input().split()]
ans = -1
true = 1
while true == 1:
	for i in range(n):
		if a[i] % 2 != 0:
			true = 0
			break
		else:
			a[i] /= 2
	ans += 1
print(ans)


N = int(input())
A = list(map(int, input().split()))
count = 0
roop = True
while roop == True:
	for i in range(N):
		if A[i] % 2 == 0:
			A[i] /= 2
		else:
			roop = False
			break
	if roop == True:
		count += 1
print(count)


n = int(input())
a = [int(x.strip()) for x in input().split()]
(ch, ans) = (0, 0)
flg = 'OK'
while flg == 'OK':
	for x in a:
		if x % 2 == 0:
			ch += 1
		else:
			break
	if ch == n:
		flg = 'OK'
		ch = 0
		ans += 1
		a = list(map(lambda x: int(x / 2), a))
	else:
		flg = 'NG'
print(ans)


N = int(input())
a = list(map(int, input().split()))
cnt = 0
while all((i % 2 == 0 for i in a)):
	a = [i / 2 for i in a]
	cnt += 1
print(cnt)


n = int(input())
ln = [int(a) for a in input().split()]
i = 0
while all((a % 2 == 0 for a in ln)):
	ln = [a // 2 for a in ln]
	i += 1
print(i)


input()

def a(n):
	return 0 if n % 2 else a(n // 2) + 1
print(min([a(i) for i in list(map(int, input().split()))]))


N = int(input())
A = list(map(int, input().split()))
i = 1
escape = False
while 1:
	for j in range(N):
		if A[j] % 2 ** i == 0:
			pass
		else:
			escape = True
			break
	else:
		i += 1
	if escape:
		break
print(i - 1)


N = int(input())
A = list(map(int, input().split()))
k = 0
while all((i % 2 == 0 for i in A)):
	A = [i / 2 for i in A]
	k += 1
print(k)


input()
l = list(map(int, input().split()))
count = 0
while all((i % 2 == 0 for i in l)):
	l = [i / 2 for i in l]
	count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
ans = 0
while all((aa % 2 == 0 for aa in a)):
	ans += 1
	a = [aa // 2 for aa in a]
print(ans)


n = int(input())
arr = list(map(int, input().split()))
cnt_arr = []
for ele in arr:
	cnt = 0
	while ele % 2 == 0:
		ele /= 2
		cnt += 1
	cnt_arr.append(cnt)
print(min(cnt_arr))


import math
N = input()
A = list(map(int, input().split()))
cnt = 0
while all((a % 2 == 0 for a in A)):
	A = [a / 2 for a in A]
	cnt += 1
print(cnt)


n = int(input())

def f(x):
	x = int(x)
	cnt = 0
	while x % 2 == 0:
		cnt += 1
		x = x // 2
	return cnt
a = list(map(f, input().split()))
print(min(a))


input()
print(min(map(lambda a: int(a) & -int(a), input().split())).bit_length() - 1)


n = int(input())
n = eval(input().replace(' ', '|'))
for i in range(2000):
	if n & 1 << i:
		print(i)
		break


import re
input()
An = input().split()
print(min((len((re.findall('0+$', bin(int(a))) + [''])[0]) for a in An)))


n = int(input())
a = list(map(int, input().split()))
INF = 10 ** 9

def how_many_times_divisible(x):
	ans = 0
	while x % 2 == 0:
		x /= 2
		ans += 1
	return ans
ans = INF
for i in range(n):
	if how_many_times_divisible(a[i]) < ans:
		ans = how_many_times_divisible(a[i])
print(ans)


N = int(input())
A = [int(x) for x in input().split()]
import math
mn = min((x & -x for x in A))
print(int(math.log(mn, 2)))


input()
a = list(map(int, input().split()))
b = 0
while all((i % 2 == 0 for i in a)):
	a = [i / 2 for i in a]
	b += 1
print(b)


N = int(input())
A = list(map(int, input().split()))
ans = 999
for a in A:
	ans = min(ans, bin(a)[::-1].index('1'))
print(ans)


import numpy as np
n = int(input())
A = np.array(input().split(), np.int64)
cnt = 0
while np.all(A % 2 == 0):
	A = A // 2
	cnt += 1
print(cnt)


n = int(input())
l = list(map(int, input().split()))
cnt = 0
while all((x % 2 == 0 for x in l)):
	l = list(map(lambda x: x // 2, l))
	cnt += 1
print(cnt)


N = int(input())
A = list(map(int, input().split()))
ans = float('inf')
for i in range(N):
	temp = 0
	while A[i] % 2 == 0:
		A[i] /= 2
		temp += 1
	ans = min(ans, temp)
print(ans)


n = int(input())
ans = min(map(lambda x: bin(int(x))[::-1].index('1'), input().split()))
print(ans)


N = int(input())
A = list(map(int, input().split()))
ans = 0
while True:
	exist_odd = False
	for n in range(N):
		if A[n] % 2 == 1:
			exist_odd = True
			break
		else:
			A[n] //= 2
	if exist_odd:
		break
	ans += 1
print(ans)


N = input()
S = map(int, input().split())
sum = 0
for num in S:
	sum = sum | num
for i in range(200):
	if sum >> i & 1 == 1:
		print(i)
		break


N = int(input())
A = list(map(int, input().split()))
ans = []
for a in A:
	ans.append(format(a, 'b')[::-1].find('1'))
print(min(ans))


input()
print(min(((int(x) & -int(x)).bit_length() for x in input().split())) - 1)


from typing import List

def answer(n: int, a: List[int]) -> int:
	count = 1
	while all((i % 2 ** count == 0 for i in a)):
		count += 1
	return count - 1

def main():
	n = int(input())
	a = list(map(int, input().split()))
	print(answer(n, a))

def __starting_point():
	main()
__starting_point()


import sys
n = input()
li = list(map(int, input().split()))
for i in li:
	if i % 2 != 0:
		print('0')
		return
count = 0
while True:
	for (index, item) in enumerate(li):
		if item % 2 == 0:
			li[index] = item / 2
		else:
			print(count)
			return
	count += 1


N = int(input())
A = list(map(int, input().split()))
ans = 10 ** 9
for x in A:
	if x % 2 == 1:
		print(0)
		return
	c = 0
	while x % 2 == 0:
		x //= 2
		c += 1
	ans = min(ans, c)
print(ans)


N = int(input())
A = list(map(int, input().split()))
count = 0
while all((a % 2 == 0 for a in A)):
	A = [i / 2 for i in A]
	count += 1
print(count)


N = int(input())
A = [int(s) for s in input().split()]
ans = min([(a & -a).bit_length() - 1 for a in A])
print(ans)


n = input()
x = list(map(int, input().split()))
i = 0
while all(map(lambda x: x % 2 == 0, x)):
	x = list(map(lambda x: x / 2, x))
	i += 1
print(i)


N = int(input())
A = eval(input().replace(' ', '|'))
print(str(bin(A))[::-1].find('1'))


n = int(input())
a = list(map(int, input().split()))
x = 0
t = True
while t:
	for i in range(n):
		if a[i] % 2 == 1:
			t = False
		else:
			a[i] /= 2
	if t == True:
		x += 1
print(x)


import numpy as np
N = int(input())
A = list(map(int, input().split()))
ans = 0

def func1(n):
	return n / 2

def func2(n):
	return n % 2
i = 0
while i == 0:
	x = list(map(func2, A))
	if sum(x) == 0:
		ans += 1
		A = list(map(func1, A))
	else:
		break
print(ans)


n = int(input())
A = list(map(int, input().split()))
ans = 0
while all((A[i] % 2 == 0 for i in range(n))):
	A = [a / 2 for a in A]
	ans += 1
print(ans)


def f(n):
	c = 0
	while n & 1 == 0:
		c += 1
		n >>= 1
	return c
input()
a = map(int, input().split())
print(min((f(x) for x in a)))


N = int(input())
A = list(map(int, input().split()))
ans = 0
is_end = False
while True:
	for a in A:
		if a % 2 != 0:
			is_end = True
			break
	if is_end:
		break
	ans += 1
	A = [a / 2 for a in A]
print(ans)


def divide(l):
	for i in range(len(l)):
		if l[i] % 2 == 0:
			l[i] = int(l[i] / 2)
		else:
			return False
	return True
n = int(input())
l = list(map(int, input().split()))
count = 0
while divide(l):
	count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
ans = 1000
for i in range(n):
	x = a[i]
	shift = 0
	while x % 2 == 0:
		x = int(x / 2)
		shift += 1
	ans = min(ans, shift)
	if ans == 0:
		break
print(ans)


n = input()
a = list(map(int, input().split()))
cnt = 0
while all((x % 2 == 0 for x in a)):
	cnt += 1
	a = [x // 2 for x in a]
print(cnt)


n = int(input())
A = list(map(int, input().split()))
K = 0
while all((a % 2 == 0 for a in A)):
	A = [a / 2 for a in A]
	K += 1
print(K)


n = int(input())
(*a,) = map(int, input().split())
ans = 0
while all((i % 2 == 0 for i in a)):
	a = [i // 2 for i in a]
	ans += 1
print(ans)


N = int(input())
A = [int(i) for i in input().split()]
B = A.copy()
OK = True
count = 0
while OK:
	for c in range(N):
		if A[c] % 2 == 0:
			A[c] = A[c] // 2
			if A[-1] == B[-1] / 2 ** (count + 1):
				count += 1
		else:
			OK = False
			break
print(count)


N = int(input())
nums = [int(s) for s in input().split()]
i = 0
cnt = 0
while True:
	if i == N:
		i = 0
		cnt += 1
	if nums[i % N] % 2 == 1:
		break
	nums[i % N] //= 2
	i += 1
print(cnt)


N = int(input())
a = list(map(int, input().split()))
print(min([format(a[i], 'b')[::-1].find('1') for i in range(N)]))


N = int(input())
li = list(map(int, input().split()))
flag = True
ans = -1
while flag:
	ans += 1
	newlist = []
	for i in li:
		newlist.append(i // 2)
		if i % 2 != 0:
			flag = False
	li = newlist
print(ans)


def main():
	n = int(input())
	nums = list(map(int, input().split()))
	ans = 0
	flg = True
	while flg:
		for i in range(len(nums)):
			if nums[i] % 2 == 0:
				num = nums[i] / 2
				nums[i] = num
			else:
				flg = False
				break
		if flg:
			ans += 1
	print(ans)

def __starting_point():
	main()
__starting_point()


N = input()
a = list(map(int, input().split()))
res = 10 ** 9
for i in a:
	count = 0
	while i % 2 == 0:
		count += 1
		i = i / 2
	if count < res:
		res = count
print(res)


num = int(input())
nu_list = [int(v) for v in input().split()]
count = 0
bool = True
while bool == True:
	for i in range(len(nu_list)):
		if nu_list[i] % 2 != 0:
			bool = False
			break
		else:
			nu_list[i] = nu_list[i] // 2
	if bool == True:
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
	cnt = cnt | a[i]
j = 0
ans = 0
while 1:
	if cnt >> j & 1 == 0:
		ans += 1
		j += 1
	else:
		break
print(ans)


def n2(a):
	return n2(a // 2) + 1 if a % 2 == 0 else 0
N = int(input())
A = list(map(int, input().split()))
print(min(map(n2, A)))


import sys
input = sys.stdin.readline
import numpy as np

def main():
	n = input()
	A = np.array(input().split(), dtype=np.int32)
	answer = 0
	while np.all(A % 2 == 0):
		A //= 2
		answer += 1
	print(answer)

def __starting_point():
	main()
__starting_point()


num = int(input())
vals = list(map(int, input().split()))
cnt = 0
flag = True
while flag:
	for i in range(num):
		if vals[i] % 2 == 1:
			print(cnt)
			flag = False
			break
		else:
			vals[i] = vals[i] / 2
	cnt += 1


n = input()
A = list(map(int, input().split()))
ans = 0
while not any((a % 2 for a in A)):
	ans += 1
	A = [a / 2 for a in A]
print(ans)


divided_2 = lambda x: int(x / 2)
enable_divided_2 = lambda x: True if int(x % 2) == 0 else False
n = int(input())
A = list(map(int, input().split()))
cnt = 0
while 1:
	if False in list(map(enable_divided_2, A)):
		break
	A = list(map(divided_2, A))
	cnt += 1
print(cnt)


(n, *a) = map(int, open(0).read().split())
c = 10 ** 9
for i in a:
	t = 0
	while ~i >> t & 1:
		t += 1
	c = min(c, t)
print(c)


def pow(n):
	if n % 2 == 1:
		return 0
	return 1 + pow(n / 2)
input()
print(min([pow(int(x)) for x in input().split()]))


input()
n = eval(input().replace(' ', '|'))
print(len(bin(n & -n)) - 3)


N = input()
X = list(map(int, input().split()))
count = 0
while all((x % 2 == 0 for x in X)):
	X = [x / 2 for x in X]
	count += 1
print(count)


a = input()
b = list(map(int, input().split()))
num = 0
while max([i % 2 for i in b]) != 1:
	b = [i / 2 for i in b]
	num += 1
print(num)


N = input()
A = list(map(int, input().split()))
ans = float('inf')
for i in A:
	ans = min(ans, len(bin(i)) - bin(i).rfind('1') - 1)
print(ans)


N = int(input())
A = list(map(int, input().split()))

def rec(A):
	B = [0] * N
	for i in range(N):
		if A[i] % 2 != 0:
			return 0
		B[i] = A[i] / 2
	return rec(B) + 1
print(rec(A))


def f(n, a):
	count = 0
	while True:
		for i in range(n):
			if a[i] % 2 == 0:
				a[i] = a[i] / 2
			else:
				return count
		count += 1
n = int(input())
a = [int(s) for s in input().split()]
print(f(n, a))


N = int(input())
a = list(map(int, input().split()))
dev = lambda x: x / 2
amari = lambda x: x % 2
for i in range(1000):
	amari_a = list(map(amari, a))
	if amari_a.count(1) > 0:
		break
	a = list(map(dev, a))
print(i)


n = int(input())
a = [int(s) for s in input().split()]
ans = 0
parity = True
while parity:
	for i in range(n):
		if a[i] % 2 == 0:
			a[i] = a[i] / 2
		else:
			parity = False
	if parity:
		ans += 1
print(ans)


import numpy as np
N = int(input())
arr = np.array(list(map(int, input().split())))
cnt = 0
while True:
	if np.sum(arr % 2) > 0:
		break
	else:
		arr = arr / 2
		cnt += 1
print(cnt)


N = int(input())
A_lst = list(map(int, input().split()))
cnt = 0
A_lst_c = []
for i in range(N):
	while A_lst[i] % 2 == 0:
		A_lst[i] //= 2
		cnt += 1
	if i == 0:
		pass
	else:
		cnt = cnt - A_lst_c[i - 1]
	A_lst_c.append(cnt)
A_lst_c_min = min(A_lst_c)
print(A_lst_c_min)


(_, t) = open(0)
n = eval(t.replace(' ', '|'))
print(len(bin(n & -n)) - 3)


input()
print(min(((a & -a).bit_length() - 1 for a in map(int, input().split()))))


n = int(input())
l = list(map(int, input().split()))
ans = 1000
for i in l:
	t = 0
	while i % 2 == 0:
		i = i // 2
		t += 1
	ans = min(ans, t)
print(ans)


import sys
n = int(input())
a = list(map(int, input().split()))
cnt = [0] * n
while 1:
	for i in range(n):
		if a[i] % 2 == 0:
			a[i] /= 2
			cnt[i] += 1
		else:
			print(min(cnt))
			return


input()
a = list(map(int, input().split()))
count = 0
while all((x % 2 == 0 for x in a)):
	a = [x / 2 for x in a]
	count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
for i in range(100):
	for j in range(len(a)):
		if a[j] % 2 == 0:
			a[j] //= 2
		else:
			print(i)
			return


n = input()
a = list(map(int, input().split()))
cut = 0
while all((i % 2 == 0 for i in a)):
	a = [i / 2 for i in a]
	cut += 1
print(cut)


def f(x):
	x = int(x)
	res = 0
	while x % 2 == 0:
		x //= 2
		res += 1
	return res
input()
print(min(map(f, input().split())))


n = int(input())
a = list(map(int, input().split()))
count = 0
while True:
	odd = False
	for x in range(n):
		if a[x] % 2 != 0:
			odd = True
			break
		else:
			a[x] //= 2
	if odd:
		break
	count += 1
print(count)


N = int(input())
A = list(map(int, input().split()))
ans = 0
while all((n % 2 == 0 for n in A)):
	A = [n / 2 for n in A]
	ans += 1
print(ans)


_ = input()
a = [int(x) for x in input().split()]
f = lambda x: len(bin(x & -x)[2:].split('1')[-1])
print(min([f(x) for x in a]))


n = int(input())
a = list(map(int, input().split()))
ans = 0
for ans in range(31):
	for (i, A) in enumerate(a):
		if A % 2:
			print(ans)
			return
		a[i] //= 2


N = int(input())
data = map(int, input().split())

def wareru(n):
	p = 0
	while n % 2 == 0:
		n = n // 2
		p = p + 1
	return p
print(min(map(wareru, data)))


n = int(input())
a = list(map(int, input().split()))
ans = 30
for i in a:
	ans = min(ans, len(bin(i)) - bin(i).rfind('1') - 1)
print(ans)


import numpy as np
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)
count = 0
flag = True
while flag:
	for i in range(N):
		if A[i] % 2 == 1:
			flag = False
	A = A / 2
	if flag:
		count += 1
print(count)


input()
A = list(map(int, input().split()))
cnt = 0
while all((x % 2 == 0 for x in A)):
	A = [x / 2 for x in A]
	cnt = cnt + 1
print(cnt)


N = int(input())
A = [int(i) for i in input().split()]
print(min([min(bin(i)[::-1].index('1'), len(bin(i)) - 2) for i in A]))


n = input()
a = set(list(map(int, input().split())))
ans = 100
for i in a:
	x = bin(i)[::-1].index('1')
	ans = x if ans > x else ans
print(ans)


N = input()
A = [int(a) for a in input().split()]
c = 0
while all((aa % 2 == 0 for aa in A)):
	c += 1
	A = [int(aaa / 2) for aaa in A]
print(c)


s = int(input())
y = list(map(int, input().split()))
x = 0
while all((a % 2 == 0 for a in y)):
	y = [a / 2 for a in y]
	x += 1
print(x)


N = int(input().strip())
A = list(map(int, input().split()))
ct = 0
while sum((i % 2 for i in A)) == 0:
	ct += 1
	A = [i // 2 for i in A]
print(ct)


input()
n = eval(input().replace(' ', '|'))
for i in range(201):
	if n & 1 << i:
		print(i)
		break


num = int(input())
a = list(map(int, input().split()))
count = 0
while all((i % 2 == 0 for i in a)):
	a = [i / 2 for i in a]
	count += 1
print(count)


(_, *a) = map(int, open(0).read().split())
c = -1
while all(a):
	c += 1
	(*a,) = map(lambda x: x // 2 * (x % 2 < 1), a)
print(c)


input()
s = list(map(int, input().split()))
bl = 0
for i in s:
	bl |= i
print(len(bin(bl & -bl)) - 3)


N = input()
li = list(map(int, input().split()))
x = 0
while all((a % 2 == 0 for a in li)):
	li = [a / 2 for a in li]
	x += 1
print(x)


n = int(input())
list_a = [int(i) for i in input().split()]
ans = 0
flag = True
while flag:
	for i in range(0, len(list_a)):
		if list_a[i] % 2 == 0:
			list_a[i] = list_a[i] // 2
		else:
			flag = False
			break
		if i == len(list_a) - 1:
			ans += 1
print(ans)


n = int(input())
A = list(map(int, input().split()))
for i in range(n):
	b = bin(A[i])
	A[i] = len(b) - b.rfind('1') - 1
print(min(A))


n = int(input())
a = list(map(int, input().split()))
count = -1
for j in range(10 ** 5):
	count += 1
	for i in range(n):
		if a[i] % 2 != 0:
			print(count)
			return
		a[i] //= 2
print(count)


N = int(input())
an = list(map(int, input().split()))
n = 0
while all((a % 2 == 0 for a in an)):
	an = [a // 2 for a in an]
	n += 1
print(n)


N = int(input())
L = list(map(int, input().split()))
l = []
for i in L:
	l.append(format(i, 'b')[::-1].find('1'))
print(min(l))


n = int(input())
a = list(map(int, input().split()))
cnt = 0
while True:
	exist_odd = False
	for index in range(len(a)):
		if a[index] % 2 != 0:
			exist_odd = True
		a[index] /= 2
	if exist_odd:
		break
	cnt = cnt + 1
print(cnt)


def div_by_2(n):
	res = 0
	while n % 2 == 0:
		n //= 2
		res += 1
	return res
N = int(input())
A = list(map(int, input().split()))
print(min(map(div_by_2, A)))


N = input()
list = list(map(int, input().split()))
m = 0
while all((a % 2 == 0 for a in list)):
	list = [a / 2 for a in list]
	m += 1
print(m)


input()
c = list(map(int, input().split()))
count = 0
while all((w % 2 == 0 for w in c)):
	c = [w / 2 for w in c]
	count += 1
print(count)


N = int(input())
A = list(map(int, input().split()))

def cnt(x):
	ret = 0
	while x % 2 == 0:
		ret += 1
		x //= 2
	return ret
ans = 30
for a in A:
	ans = min(ans, cnt(a))
print(ans)


N = input()
n = int(eval(input().replace(' ', '|')))
print(len(str(bin(n & -n))[3:]))


n = input()
a = [bin(int(x))[2:] for x in input().split()]
a = [len(x) - (x.rfind('1') + 1) for x in a]
print(min(a))


n = int(input())
as_ = (int(i) for i in input().split())
pow2s = [len(bin(i)) - bin(i).rfind('1') - 1 for i in as_]
print(min(pow2s))


n = int(input())
a = list(map(int, input().split()))
count = 0
while True:
	flg = False
	for i in range(n):
		if a[i] % 2 != 0:
			flg = True
	if flg:
		break
	for j in range(n):
		a[j] /= 2
	count += 1
print(count)


N = int(input())
a = list((int(x) for x in input().split()))
ans = 0
flag = True
while flag:
	for i in range(N):
		if a[i] % 2 == 0:
			a[i] /= 2
		else:
			flag = False
			break
	if flag:
		ans += 1
print(ans)


n = int(input())
aa = list(map(int, input().split()))
ans = 100
for i in range(n):
	x = 0
	while aa[i] > 0:
		if aa[i] % 2 != 0:
			break
		aa[i] //= 2
		x += 1
	ans = min(ans, x)
print(ans)


n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
	cnt = 0
	while i % 2 == 0:
		cnt += 1
		i //= 2
	l.append(cnt)
print(min(l))


n = int(input())
A = list(map(int, input().split()))
b = 0
for a in A:
	b |= a
cnt = 0
while b % 2 == 0:
	b //= 2
	cnt += 1
print(cnt)


input()
print(min((j.index('1') for j in (tuple(bin(int(i))[::-1]) for i in input().split()))))


n = int(input())
a = list(map(int, input().split()))
count = 0
exist_odd = False
while exist_odd == False:
	for i in range(n):
		if a[i] % 2 != 0:
			exist_odd = True
			if n != i:
				count -= 1
			break
		else:
			a[i] = a[i] / 2
	count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
b = []
cnt = 0
for i in range(n):
	if a[i] % 2 == 1:
		print('0')
		return
	else:
		while a[i] % 2 == 0:
			cnt += 1
			a[i] /= 2
		b.append(cnt)
		cnt = 0
print(min(b))


n = int(input())
li = list(map(int, input().split()))
li.sort()
cnt = 0
guu = 0
for j in range(100000):
	guu = 0
	for i in range(len(li)):
		if li[i] % 2 == 0:
			guu += 1
	if guu == n:
		for i in range(len(li)):
			li[i] = li[i] // 2
		cnt += 1
	else:
		print(cnt)
		return


n = int(input())
s = list(map(int, input().split()))
count = -0
while all((i % 2 == 0 for i in s)):
	s = [i / 2 for i in s]
	count += 1
print(count)


input()
List = list(map(int, input().split()))
ans = 0
while all((l % 2 == 0 for l in List)):
	List = [l / 2 for l in List]
	ans += 1
print(ans)


n = int(input())
x = [int(i) for i in input().split()]
answer = 0
while all((i % 2 ** (answer + 1) == 0 for i in x)):
	answer += 1
print(answer)


N = int(input())
A = list(map(int, input().split()))
ans = 0
while 1:
	flg = 0
	for i in range(N):
		if A[i] % 2 == 0:
			A[i] /= 2
		else:
			flg = 1
			break
	if flg == 1:
		break
	ans += 1
print(ans)


input()
A = list(map(int, input().split()))
print(min((len(bin(a & -a)) - 3 for a in A)))


print(-(int(input()) > 0) + next(filter(lambda x: any(map(lambda y: y % 2 ** x[1] > 0, x[0])), zip([list(map(int, input().split()))] * 99, range(99))))[1])


N = int(input())
A = sorted(['{:b}'.format(int(x))[::-1] for x in input().split()])
print(A[-1].find('1'))


input()
(a, b) = (list(map(int, input().split())), 0)
while True:
	(c, b) = (a, b + 1)
	a = [i // 2 for i in a if i % 2 == 0]
	if len(a) < len(c):
		print(b - 1)
		break


input()
print(min([len(bin(int(num)).rsplit('1', 1).pop(-1)) for num in input().split()]))


n = int(input())
A = [0] * n
L = list(map(int, input().split()))
for i in range(n):
	cnt = 0
	while L[i] % 2 == 0:
		L[i] = L[i] / 2
		cnt += 1
	A[i] = cnt
print(min(A))


N = int(input())
A = [int(i) for i in input().split()]
cnt = 0
while all((a % 2 == 0 for a in A)):
	A = [a / 2 for a in A]
	cnt += 1
print(cnt)


def is_divide(an):
	for (i, a) in enumerate(an):
		if a % 2 == 0:
			an[i] = a / 2
		else:
			return False
	return True
n = int(input())
an = list(map(int, input().split()))
count = 0
while True:
	if not is_divide(an):
		break
	count += 1
print(count)


n = int(input())
a_lst = list(map(int, input().split()))
res = []
for a in a_lst:
	tmp = a
	cnt = 0
	while tmp % 2 == 0:
		tmp = tmp // 2
		cnt += 1
	res.append(cnt)
print(min(res))


from fractions import *
input()
x = 2 ** 30
c = 0
for i in input().split():
	x = gcd(x, int(i))
while x > 1:
	x //= 2
	c += 1
print(c)


N = int(input())
A = list(map(int, input().split()))
cnt = 0
while all((i % 2 == 0 for i in A)):
	A = [j / 2 for j in A]
	cnt += 1
print(cnt)


n = int(input())
(*a,) = map(int, input().split())
c = 0
while all([i % 2 == 0 for i in a]):
	a = [j / 2 for j in a]
	c += 1
print(c)


n = int(input())
data = list(map(int, input().split()))
bool = True
count = 0
while bool:
	for i in range(n):
		if data[i] % 2 != 0:
			bool = False
		data[i] = data[i] // 2
	if bool == False:
		print(count)
	count += 1


N = int(input())
ls = [int(s) for s in input().split()]
count = 0
while sum([n % 2 for n in ls]) == 0:
	count += 1
	ls = [n // 2 for n in ls]
print(count)


input()
a = [int(x) for x in input().split()]
c = 0
while all((x % 2 == 0 for x in a)):
	c += 1
	a = [x // 2 for x in a]
print(c)


n = int(input())
A = list(map(int, input().split()))
c = 0
while all([a % 2 == 0 for a in A]):
	A = list(map(lambda i: i // 2, A))
	c += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
ma = len(bin(10 ** 9))
for i in range(n):
	cnt = 0
	while a[i] % 2 == 0:
		a[i] /= 2
		cnt += 1
	ma = min(ma, cnt)
print(ma)


n = int(input())
a_list = list(map(int, input().split()))
new_list = []
ans = 0
while True:
	for i in a_list:
		if i % 2 == 1:
			break
		else:
			a = i // 2
			new_list.append(a)
	if len(new_list) < n:
		break
	ans += 1
	a_list = new_list
	new_list = []
print(ans)


n = int(input())
l = list(map(int, input().split()))
c = 0
while all((a % 2 == 0 for a in l)):
	l = [a / 2 for a in l]
	c += 1
print(c)


n = int(input())
ls = list(map(int, input().split()))
ans = float('inf')
for i in range(n):
	p = 1
	while True:
		if ls[i] / 2 ** p % 1 == 0:
			p += 1
		else:
			p -= 1
			break
	if p < ans:
		ans = p
print(ans)


def resolve():
	_ = int(input())
	a = list(map(int, input().split()))
	res = 0
	while all((i % 2 == 0 for i in a)):
		res += 1
		a = list(map(lambda x: x / 2, a))
	print(res)
resolve()


n = int(input())
a = list(map(int, input().split()))
ans = 0
flag = False
while flag == False:
	for i in range(n):
		if a[i] % 2 == 0:
			a[i] /= 2
		else:
			flag = True
			break
	else:
		ans += 1
print(ans)


import numpy as np
n = int(input())
p = list(map(int, input().split()))
p = np.array(p)
cnt = 0
while cnt < 10000000:
	for i in p:
		if i % 2 != 0:
			print(cnt)
			return
	cnt += 1
	p = p // 2


n = int(input())
l = list(map(int, input().split()))
result = 0
loop = 0
while True:
	if all((x % 2 == 0 for x in l)):
		result += 1
		for data in range(len(l)):
			l[data] = l[data] // 2
	else:
		print(result)
		return


N = int(input())
L = list(map(int, input().split()))
i = 0
while all((l % 2 == 0 for l in L)):
	L = [l / 2 for l in L]
	i += 1
print(i)


n = int(input())
a = list(map(int, input().split()))
b = [bin(i) for i in a]
print(min([len(i) - i.rfind('1') - 1 for i in b]))


import sys
iimr = lambda : map(int, sys.stdin.readline().rstrip().split())
readline = sys.stdin.readline

def debug(*x):
	print(*x, file=sys.stderr)

class atcoder:

	def __init__(s):
		f = open(0)
		s.N = int(f.readline())
		s.A = list(map(int, f.readline().split()))

	def çözmek(s):
		res = []
		res.append(s.関数(s.N, s.A))
		print(*res)

	def 関数(self, n, a):
		guusuu = True
		cnt = 0
		while guusuu:
			for i in range(n):
				if a[i] % 2 != 0:
					guusuu = False
					break
				else:
					a[i] /= 2
			if guusuu:
				cnt += 1
		return cnt

def __starting_point():
	ima = atcoder()
	ima.çözmek()
__starting_point()


N = int(input())
print(min(map(lambda x: bin(int(x))[::-1].index('1'), input().split())))


n = int(input())
li = list(map(int, input().split()))
b = float('inf')
for a in li:
	c = 0
	while a % 2 == 0:
		a = a / 2
		c += 1
	b = min(b, c)
print(b)


N = input()
A = list(map(int, input().split()))
sum = 0
while all((a % 2 == 0 for a in A)):
	A = [a / 2 for a in A]
	sum += 1
print(sum)


N = int(input())
a = list(map(int, input().split()))
ans = 0
exist = True
while exist:
	for i in range(N):
		if a[i] % 2 != 0:
			exist = False
		else:
			a[i] = a[i] // 2
	if exist:
		ans += 1
print(ans)


import sys

def solve(N, A):
	count = 0
	while True:
		for i in range(N):
			if A[i] % 2 > 0:
				print(count)
				return
			A[i] = A[i] / 2
		count += 1

def __starting_point():
	N = int(input())
	A = list(map(int, input().split()))
	solve(N, A)
__starting_point()


n = int(input())
ary = list(map(int, input().split()))

def count_ops(ary):
	count = 0
	while 1:
		for (i, v) in enumerate(ary):
			if v % 2 == 1:
				return count
			else:
				ary[i] = v / 2
		count += 1
	return count
print(count_ops(ary))


n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in a:
	ans |= i
n = ans & -ans
print(n.bit_length() - 1)


N = int(input())
A = list(map(int, input().split()))
k = 0
while 1 not in [a % 2 for a in A]:
	k += 1
	A = [a // 2 for a in A]
print(k)


N = int(input())
l = list(map(int, input().split()))
counter = 0
flag = 1
while flag == 1:
	for i in range(len(l)):
		if l[i] % 2 != 0:
			flag = 0
			break
		else:
			l[i] = int(l[i] / 2)
	if flag == 1:
		counter += 1
print(counter)


import math
import sys
sys.setrecursionlimit(10 ** 6)
n = int(input())
a = list(map(int, input().split()))
ans = 10 ** 10
for i in a:
	tmp = 0
	while i % 2 != 1:
		tmp += 1
		i = i // 2
	ans = min(ans, tmp)
print(ans)


n = int(input())
l = list(input().split(' '))
flag = True
t = 0
while True:
	for (i, x) in enumerate(l):
		if int(x) % 2 == 0:
			l[i] = int(x) / 2
		else:
			flag = False
			break
	if flag:
		t += 1
	else:
		break
print(t)


n = int(input())
a = map(int, input().split())
ans = float('inf')
for i in a:
	ans = min(ans, len(bin(i)) - bin(i).rfind('1') - 1)
print(ans)


input()
a = min(list(map(lambda x: int(x) & -int(x), input().split())))
i = 0
while a:
	a //= 2
	i += 1
print(i - 1)


N = int(input())
A = list(map(int, input().split()))
count = 0
for _ in range(30):
	for i in range(N):
		B = A[i] % 2
		if B == 1:
			break
		A[i] = A[i] // 2
	else:
		count += 1
		continue
	break
print(count)


input()
a = 0
b = list(map(int, input().split()))
while 1:
	for x in b:
		if x >> a & 1:
			print(a)
			exit()
	a += 1


N = int(input())
A = [int(i) for i in input().split()]
ans = 0
while all((i % 2 == 0 for i in A)):
	A = [i / 2 for i in A]
	ans += 1
print(ans)


hoge = input()
int_line = [int(i) for i in input().split()]
cnt = 0
flag = False
while True:
	for (m, i) in enumerate(int_line):
		if i % 2 == 0:
			int_line[m] = i / 2
		else:
			flag = True
	if flag == True:
		print(cnt)
		break
	else:
		cnt += 1


input()
print(min((len(str(bin(i & -i))) for i in map(int, input().split()))) - 3)


n = int(input())
l = list(map(int, input().split()))
cnt = 0
while all((i % 2 == 0 for i in l)):
	cnt += 1
	l = [i // 2 for i in l]
print(cnt)


N = int(input())
A_list = list(map(int, input().split()))
ans_list = []
temp_ans = 0
for value in A_list:
	temp_value = value
	temp_ans = 0
	while temp_value % 2 == 0:
		temp_value /= 2
		temp_ans += 1
	ans_list.append(temp_ans)
print(min(ans_list))


c = 0
(_, *l) = map(int, open(0).read().split())
while all(map(lambda i: i & 1 == 0, l)):
	l = list(map(lambda i: i >> 1, l))
	c += 1
print(c)


(n, *a) = map(int, open(0).read().split())
from functools import reduce
e = reduce(lambda x, y: x | y, a, 0)
print((e ^ e - 1).bit_length() - 1)


n = int(input())
a = list(map(int, input().split()))
count = 0
while sum([i % 2 ** (count + 1) for i in a]) == 0:
	count += 1
print(count)


getints = lambda : map(int, input().split())
n = int(input())
a = list(getints())
ans = 10 ** 9
for x in a:
	cnt = 0
	while x % 2 == 0:
		x /= 2
		cnt += 1
	ans = min(ans, cnt)
print(ans)


n = int(input())
n_list = list(map(int, input().split()))
count = 0

def check(list):
	for i in range(n):
		if n_list[i] % 2 != 0:
			return False
	return True
while check(n_list):
	n_list = [k / 2 for k in n_list]
	count += 1
print(count)


input()
n = eval(input().replace(' ', '|'))
print((n & -n).bit_length() - 1)


N = int(input())
A = list(map(int, input().split()))
n = 0
while list(map(lambda x: x % 2 ** (n + 1), A)).count(0) == N:
	n += 1
print(n)


n = int(input())
a = list(map(int, input().split()))
y = list()
for i in range(n):
	x = 0
	while a[i] % 2 == 0:
		a[i] /= 2
		x += 1
	y.append(x)
print(min(y))


input()
print(min(map(lambda c: bin(int(c))[::-1].index('1'), input().split())))