There are N positive integers written on a blackboard: A_1, ..., A_N.  Snuke can perform the following operation when all integers on the blackboard are even:    * Replace each integer X on the blackboard by X divided by 2.  Find the maximum possible number of operations that Snuke can perform.
n = input()
v = list(input().split())

cnt = 0
flg = True
while flg:
  for i in range(len(v)):
    if int(v[i]) %2 == 0:
      pass
    else:
      flg = False
    v[i] = int(v[i])/2
  cnt = cnt + 1

print(cnt)
n = input()
v = list(input().split())

cnt = 0
flg = True
while flg:
  for i in range(len(v)):
    if int(v[i]) %2 == 0:
      pass
    else:
      flg = False
    v[i] = int(v[i])/2
  cnt = cnt + 1

print(cnt - 1)