N = int(eval(input()))

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



ans = 0

for i in range(30):

  if 1 in [n % 2 for n in A]:

    break

  A = [n // 2 for n in A]

  ans += 1

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

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



ans = 0

for i in range(30):

  if 1 in [n % 2 for n in A]:

    break

  A = [n >> 1 for n in A]

  ans += 1

print(ans)

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

N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for i in range(30):
    if 1 in [n % 2 for n in A]:
        break
    A = [n >> 1 for n in A]
    ans += 1
print(ans)

-    A = [n // 2 for n in A] +    A = [n >> 1 for n in A]