eval(input())

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



counter = 0



while all(number % 2 == 0 for number in numbers):

    numbers = [number / 2 for number in numbers]

    counter += 1



print(counter)



N = int(eval(input()))



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

counter = 0



while all(number % 2 == 0 for number in numbers):

    numbers = [number / 2 for number in numbers]

    counter += 1



print(counter)

eval(input())
numbers = list(map(int, input().split()))
counter = 0
while all(number % 2 == 0 for number in numbers):
    numbers = [number / 2 for number in numbers]
    counter += 1
print(counter)

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

-eval(input()) +N = int(eval(input()))