n = int(eval(input()))

A = [int(i) for i in input().split()]



cnt = 0

flag = 1

while flag:

    for i in range(n):

        a = A.pop(0)

        if a % 2 != 0:

            flag = 0

            break

        else:

            A.append(a // 2)

    else:

        cnt += 1

    

print(cnt)
n = int(eval(input()))

A = [int(i) for i in input().split()]



cnt = 0

flag = 1

while flag:

    for i in range(n):

        a = A[i]

        if a % 2 != 0:

            flag = 0

            break

        else:

            A[i] = a // 2

    else:

        cnt += 1

    

print(cnt)
n = int(eval(input()))
A = [int(i) for i in input().split()]
cnt = 0
flag = 1
while flag:
    for i in range(n):
        a = A.pop(0)
        if a % 2 != 0:
            flag = 0
            break
        else:
            A.append(a // 2)
    else:
        cnt += 1
print(cnt)

n = int(eval(input()))
A = [int(i) for i in input().split()]
cnt = 0
flag = 1
while flag:
    for i in range(n):
        a = A[i]
        if a % 2 != 0:
            flag = 0
            break
        else:
            A[i] = a // 2
    else:
        cnt += 1
print(cnt)

-        a = A.pop(0) +        a = A[i] -            A.append(a // 2) +            A[i] = a // 2