N = int(eval(input()))

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

kmin = 100

for i in range(N):

    a = A[i]

    k = 0

    while a%2==0:

        k += 1

        a = a//2

    kmin = min(kmin,k)

print(kmin)
N = int(eval(input()))

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

cmin = 104

for i in range(N):

    cnt = 1

    while A[i]%(2**cnt)==0:

        cnt += 1

    cmin = min(cmin,cnt-1)

print(cmin)
N = int(eval(input()))
A = list(map(int, input().split()))
kmin = 100
for i in range(N):
    a = A[i]
    k = 0
    while a % 2 == 0:
        k += 1
        a = a // 2
    kmin = min(kmin, k)
print(kmin)

N = int(eval(input()))
A = list(map(int, input().split()))
cmin = 104
for i in range(N):
    cnt = 1
    while A[i] % (2**cnt) == 0:
        cnt += 1
    cmin = min(cmin, cnt - 1)
print(cmin)

-kmin = 100 +cmin = 104 -    a = A[i] -    k = 0 -    while a % 2 == 0: -        k += 1 -        a = a // 2 -    kmin = min(kmin, k) -print(kmin) +    cnt = 1 +    while A[i] % (2**cnt) == 0: +        cnt += 1 +    cmin = min(cmin, cnt - 1) +print(cmin)