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.
N=int(input())
AS=map(int,input().split())
tw=[]
for num in AS:
    cnt=0
    while num%2>0:
        cnt+=1
    tw.append(cnt)
print(min(tw))
N=int(input())
AS=map(int,input().split())
tw=[]
for num in AS:
    cnt=0
    while num%2==0:
        num/=2
        cnt+=1
        if num==1:
            break
    tw.append(cnt)
print(min(tw))