n = int(eval(input()))

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

ans = []

for i in range(n):

  count = 0

  while 1:

    if lis[i] %2 == 0:

      lis[i] = lis[i]/2

      count +=1

    else:

      ans.append(count)

      break

print((min(ans)))
n = int(eval(input()))

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

ans = []

cou = 0



for i in range(n):

  while m[i] % 2 == 0:

    m[i] = m[i] / 2

    cou += 1

  ans.append(cou)

  cou = 0

print((min(ans)))
n = int(eval(input()))
lis = list(map(int, input().split()))
ans = []
for i in range(n):
    count = 0
    while 1:
        if lis[i] % 2 == 0:
            lis[i] = lis[i] / 2
            count += 1
        else:
            ans.append(count)
            break
print((min(ans)))

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

-lis = list(map(int, input().split())) +m = list(map(int, input().split())) +cou = 0 -    count = 0 -    while 1: -        if lis[i] % 2 == 0: -            lis[i] = lis[i] / 2 -            count += 1 -        else: -            ans.append(count) -            break +    while m[i] % 2 == 0: +        m[i] = m[i] / 2 +        cou += 1 +    ans.append(cou) +    cou = 0