Harryxun/stf_run huggingface dataset:
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

from functools import lru_cache

def resolve():
    T = int(input())

    @lru_cache
    def f(x, i):
        if i == N:
            return "1" if x else "0"

        ans = f(x, i+1)
        if S[i] == ans:
            return ans
        return f(x^A[i], i+1)

    ans = []
    for i in range(T):
        N = int(input())
        A = list(iim())
        S  = input()

        if S[-1] == "1":
            ans.append("1")
        else:
            ans.append(f(0, 0))

        f.cache_clear()

    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()


### FIXED CODE ###

#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

X = (10**18).bit_length()

def f(a, s, n):
    if s[-1] == "1":
        return 1

    B = [None] * X
    for i in range(n-1, -1, -1):
        ai, si = a[i], s[i]

        if si == "0":
            while True:
                x = ai.bit_length() - 1
                if B[x] == ai: break
                elif B[x] == None:
                    B[x] = ai
                    break
                ai ^= B[x]
        else:
            while True:
                x = ai.bit_length() - 1
                if B[x] == ai: break
                elif B[x] == None:
                    return 1
                ai ^= B[x]
    return 0


def resolve():
    T = int(input())

    ans = []
    for i in range(T):
        N = int(input())
        A = list(iim())
        S  = input()

        ans.append(f(A, S, N))

    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()
"""from collections import *
from itertools import *
from bisect import *
from heapq import *

import math
from fractions import gcd"""
import sys
#input = sys.stdin.readline

import copy

N=int(input())
Amoto=list(map(int,input().split()))
A=copy.copy(Amoto)
_min=A[0]
minidx=0
for i in range(1,N):
    if _min>A[i]:
        _min=A[i]
        minidx=i


lst=[]
if _min<0:
    for i in range(N)[::-1]:
        while _min<A[i] and len(lst)<=2*N+1:
            A[i]+=_min
            lst.append([minidx+1,i+1])
        minidx=i
        _min=A[i]

if not len(lst)>2*N:
    print(len(lst))
    for i in lst:
        print(" ".join([str(x) for x in i ]))
    exit()
A=copy.copy(Amoto)
_max=A[0]
maxidx=0
for i in range(1,N):
    if _max<A[i]:
        _max=A[i]
        maxidx=i
if _max>0:
    for i in range(N):
        while _max>A[i] and len(lst)<=2*N+1:
            A[i]+=_max
            lst.append([maxidx+1,i+1])
        maxidx=i
        _max=A[i]
if not len(lst)>2*N:
    print(len(lst))
    for i in lst:
        print(" ".join([str(x) for x in i ]))
    exit()
else:
    print(unko)


### FIXED CODE ###

"""from collections import *
from itertools import *
from bisect import *
from heapq import *

import math
from fractions import gcd"""
import sys
#input = sys.stdin.readline

import copy

N=int(input())
Amoto=list(map(int,input().split()))
lst=[]
A=copy.copy(Amoto)
_min=A[0]
minidx=0
for i in range(1,N):
    if _min>A[i]:
        _min=A[i]
        minidx=i
if _min<0:
    for i in range(N)[::-1]:
        while _min<A[i] and len(lst)<=2*N+1:
            A[i]+=_min
            lst.append([minidx+1,i+1])
        minidx=i
        _min=A[i]

    if  len(lst)<=2*N:
        print(len(lst))
        for i in lst:
            print(" ".join([str(x) for x in i ]))
        exit()
A=copy.copy(Amoto)
_max=A[0]
maxidx=0
lst=[]
for i in range(1,N):
    if _max<A[i]:
        _max=A[i]
        maxidx=i
if _max>0:
    for i in range(N):
        while _max>A[i] and len(lst)<=2*N+1:
            A[i]+=_max
            lst.append([maxidx+1,i+1])
        maxidx=i
        _max=A[i]
    if  len(lst)<=2*N:
        print(len(lst))
        for i in lst:
            print(" ".join([str(x) for x in i ]))
        exit()
else:
    print(0)
import math

print math.pow(input(),3)

### FIXED CODE ###

n = int(input())
print(n ** 3)
import math
def resolve():
    A, B, H, M = map(int, input().split())
    #短針が1時間で進む角度 30c
    deg_H = 360/12
    # 長針が1分間で進む角度 6c
    deg_M = 360/60

    hr = deg_H*H + (deg_H/60)*M
    mr = deg_M*M
    deg = abs(hr-mr)
    if deg>180:
        deg = 360- deg

    # 角度をラジアンに直す
    red = (deg/180)*math.pi
    ans = math.sqrt(A*A + B*B - 2*A*B*math.cos(red))
    print(ans)

if __name__ == "__main__":
    resolve()


### FIXED CODE ###

n = input()

if(n[-1] == '0' or n[-1] == '6' or n[-1] == '1' or n[-1] == '8'):
    print('pon')
elif(n[-1] == '3'):
    print('bon')
else:
    print('hon')
# -*- coding: utf-8 -*-
def inpl(): return tuple(map(int, input().split()))
from math import sqrt
from itertools import combinations
import random
from math import gcd
N = int(input())
def primesd(N):
    P = [2]
    L = (N-1)//2
    searched = [False]*(L+1)
    for i in range(1, L+1):
        if searched[i]:
            continue
        j = i*2+1
        P.append(j)
        searched[i::j] = [True]*(((L-i)//j)+1)
    return P

P = primesd(int(sqrt(30000)))
S = [True]*30001
S[:2] = [False]*2

for p in P:
    i = p
    while i <= 30000:
        S[i] = False
        i *= p

for a, b in combinations(P, 2):
    S[a*b] = False

for a, b, c in combinations(P, 3):
    if a*b*c < 30000:
        S[a*b*c] = False

for a, b, c, d in combinations(P, 4):
    if a*b*c*d < 30000:
        S[a*b*c*d] = False

for a, b, c, d, e in combinations(P, 5):
    if a*b*c*d*e < 30000:
        S[a*b*c*d*e] = False

numbers = [i for i, s in enumerate(S) if s==True]

count = 0
while True:
    sample = random.sample(numbers, N-1)
    sum_ = sum(sample)
    if sum_ % 7 != 0:
        continue
    elif any([s%7!=0 for s in sample]):
        sum_ += 7
        for s in sample:
            if gcd(s, sum_-s) == 1:
                break
        else:
            sample += [7]
            print(*sample)
            break

### FIXED CODE ###

# -*- coding: utf-8 -*-
def inpl(): return tuple(map(int, input().split()))

N = int(input())
if N == 3:
    print("2 5 63")
    exit()
elif N == 4:
    print("2 5 20 63")
    exit()
elif N == 5:
    print("7 1580 9438 11373 22962")
    exit()

numbers = []

for k in range(0, 5000):
    numbers.extend([6*k+2, 6*k+3, 6*k+4, 6*k+6])

ans = numbers[:N]
S = sum(ans)


if S%6 == 0:
    pass
elif S%6 == 2:
    del ans[4]
    ans.append((ans[-1]//6 + 1)*6)
elif S%6 == 3:
    del ans[5]
    ans.append((ans[-1]//6 + 1)*6)
else:
    x, y = (ans[-1]//6)*6+4, (ans[-1]//6)*6+10
    ans.append(x if x > ans[-1] else y)
    del ans[5]
print(*ans)
S = int(input())

if S = "ABC":
    print("ARC")
else:
    print("ABC")

### FIXED CODE ###

S = input()
 
if S == "ABC":
    print("ARC")
else:
    print("ABC")
# 2019/07/12
# DFS ver

import sys

input=sys.stdin.readline

n=int(input())
edge=[[] for _ in range(n)]
for _ in range(n-1):
    u,v,c=map(int,input().split())
    u-=1 ; v-=1
    edge[u].append((c,v))
    edge[v].append((c,u))

q,k=map(int,input().split())
k-=1

d=[0]*n
visited=[False]*n

def dfs(s,p):
    visited[s]=True
    for c,v in edge[s]:
        if visited[v] or p==v:continue
        d[v]=c+d[s]
        visited[v]=True
        dfs(v,s)
    return 


dfs(k,-1)
for _ in range(q):
    x,y=map(int,input().split())
    x-=1 ; y-=1
    print(d[x]+d[y])



### FIXED CODE ###

# 2019/07/11

from heapq import heappop,heappush

n=int(input())
edge=[[] for _ in range(n)]
for _ in range(n-1):
    u,v,c=map(int,input().split())
    u-=1
    v-=1
    edge[u].append((c,v))
    edge[v].append((c,u))


def dijkstra(s):
    d=[float('inf')]*n
    visited=[False]*n
    d[s]=0
    visited[s]=True
    que=[]
    for e in edge[s]:
        heappush(que,e)
    while que:
        c,v=heappop(que)
        if visited[v]:continue
        d[v]=c
        visited[v]=True
        for cost,vtx in edge[v]:
            if visited[vtx]:continue
            hq=(cost+d[v],vtx)
            heappush(que,hq)

    return d

q,k=map(int,input().split())
k-=1

res=dijkstra(k)
for _ in range(q):
    x,y=map(int,input().split())
    x-=1
    y-=1
    print(res[x]+res[y])
import math
n,d = list(map(int, input().split()))
x = [list(map(int, input().split())) for N in range(n)]
 
kaijou = 0
cnt = 0
 
for i in n:
  for j in n:
    for k in d:
      kaijou = kaijou + (x[j][k]-x[i][k])**2
    if math.sqrt(kaioju).is_integer():
      cnt += 1
 
print(cnt-n)

### FIXED CODE ###

import math
n,d = list(map(int, input().split()))
x = [list(map(int, input().split())) for N in range(n)]
 
cnt = 0
 
for i in range(n):
  for j in range(i+1,n):
    kaijou = 0
    for k in range(d):
      kaijou = kaijou + abs(x[j][k]-x[i][k])**2
    if math.sqrt(kaijou).is_integer():
      cnt += 1
      
print(cnt)
#TLE

n, a, b = map(int, input().split())

#　ans = 2**n
na = list(bin(n))
nb = na[3:]

ans = 2

for b in nb:
    if b == '0':
        ans **= 2
    else:
        ans = (ans ** 2) * 2

if n == 0:
    ans = 1

#　数え過ぎたものを引く
def comb(n, r):
    m = 1
    for i in range(n-r+1, n+1):
        m *= i
    for i in range(1, r+1):
        m //= i
    return m
ans -= comb(n, a) + comb(n, b) + 1

print(int(ans % (1000000007)))

### FIXED CODE ###

#TLE

#comb_mod(n, r, mod) = nCr % mod
def comb_mod(n, r, mod):
    ans = 1
    if r <= n/2:
        for i in range(n-r+1, n+1):
            ans *= i
            ans %= mod
        for i in range(1, r+1):
            ans *= pow(i, mod-2, mod)
            ans %= mod
    else:
        for i in range(r+1, n+1):
            ans *= i
            ans %= mod
        for i in range(1, n-r+1):
            ans *= pow(i, mod-2, mod)
            ans %= mod
    return ans

n, a, b = map(int, input().split())
ans = pow(2, n, 10**9+7) - comb_mod(n, a, 10**9+7) - comb_mod(n, b, 10**9+7) - 1
if ans < 0:
    ans += 10**9 + 7
if ans < 0:
    ans += 10**9 + 7

print(int(ans))
s = input()
gx, gy = map(int, input().split())
n = len(s)
X, Y = [], []
x, y, flag = 0, 0, 0
for i in range(n):
    if s[i] == 'F' and flag == 0:
        x += 1
    elif s[i] == 'F' and flag == 1:
        y += 1
    else:
        if flag and y > 0:
            Y.append(y)
            y = 0
        elif not flag and x > 0:
            X.append(x)
            x = 0
        flag = (flag + 1) % 2
if flag and y > 0:
    Y.append(y)
elif not flag and x > 0:
    X.append(x)
gx -= X[0]
X.pop(0)
for x in sorted(X, reverse = True):
    if gx > 0:
        gx -= x
    else:
        gx += x
for y in sorted(Y, reverse = True):
    if gy > 0:
        gy -= y
    else:
        gy += y
if gx == gy == 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S = input() + 'E'
gx, gy = map(int, input().split())
X, Y = [], []
x, y, i, flag = 0, 0, 0, 1
while i <= len(S):
    f = 0
    while S[i] == 'F':
        f += 1
        i += 1
    if flag:
        X.append(f)
    else:
        Y.append(f)
    flag = (flag + 1) % 2
    if S[i] == 'E':
        break
    i += 1
gx -= X[0]
for x in sorted(X[1:], reverse = True):
    if gx > 0:
        gx -= x
    else:
        gx += x
for y in sorted(Y, reverse = True):
    if gy > 0:
        gy -= y
    else:
        gy += y
if gx == gy == 0:
    print("Yes")
else:
    print("No")
N = int(input())
A = list(map(int, input().split(' ')))
rod = {}
for i in A:
    if i in rod:
        rod[i] += 1
    else:
        rod[i] = 1
if len([i for i in rod.values() if i >= 2]) < 2:
    print(0)
else:
    length4 = [k for k, v in rod.items() if v >= 4]
    length4.sort()
    length2 = [k for k, v in rod.items() if v >= 2]
    length2.sort()
    if length4[-1] == length2[-1]:
        print(length4[-1]**2)
    else:
        print(length2[-2] * length2[-1])

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split(' ')))
rod = {}
for i in A:
    if i in rod:
        rod[i] += 1
    else:
        rod[i] = 1
if len([i for i in rod.values() if i >= 2]) < 2:
    print(0)
else:
    length4 = [k for k, v in rod.items() if v >= 4]
    length4.sort()
    length2 = [k for k, v in rod.items() if v >= 2]
    length2.sort()
    if len(length4) > 0 and length4[-1] == length2[-1]:
        print(length4[-1]**2)
    else:
        print(length2[-2] * length2[-1])
S = int(input())

h = S // 3600
m = S // 60 % 60
s = S % 60

print(h + ':' + m + ':' + s)

### FIXED CODE ###

S = int(input())

s = S % 60
m = S // 60 % 60
h = S // 60 // 60

print("{0}:{1}:{2}".format(h,m,s))
s = input()
si = int(s)
ans = 0
 
 
for i in range(1,300000//2019):
    d = 0
    while 1:
        if s.find(str(2019*i), d) != -1:
            ans = ans+1
            d = s.find(str(2019*i), d)+1
        else:
            break
 
print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
if n>m:
  print("safe")
else:
  print("unsafe")
from itertools import combinations

N, M, X = map(int, input().split())
skill = [0] * M
N_list = []
C_sum = 0
all_list = [0] * (M+1)

res_list = 0
for i in range(N):
  list_ = list(map(int, input().split()))
  N_list.append(list_)
  all_list = [all_list[i]+list_[i] for i in range(M+1)]
if all(all_list[j] < X for j in range(1, M+1)):
  print(-1)
  exit()
result = []  
for i in range(1, N+1):
  ref = list(combinations(N_list, i))
  for j in range(len(ref)):
    sums = [0] * (M+1)
    for k in range(i):
      sums = [sums[l]+ref[j][k][l] for l in range(M+1)]
    result.append(sums)
kekka = []
for i in range(len(result)):
  if all(result[i][j]>=X for j in range(1, M+1)):
    kekka.append(result[i][0])
print(min(kekka))

### FIXED CODE ###

from itertools import combinations

N, M, X = map(int, input().split())
skill = [0] * M
N_list = []
C_sum = 0
all_list = [0] * (M+1)

res_list = 0
for i in range(N):
  list_ = list(map(int, input().split()))
  N_list.append(list_)
  all_list = [all_list[i]+list_[i] for i in range(M+1)]

result = []  
for i in range(1, N+1):
  ref = list(combinations(N_list, i))
  for j in range(len(ref)):
    sums = [0] * (M+1)
    for k in range(i):
      sums = [sums[l]+ref[j][k][l] for l in range(M+1)]
    result.append(sums)
kekka = []
for i in range(len(result)):
  if all(result[i][j]>=X for j in range(1, M+1)):
    kekka.append(result[i][0])
if kekka != []:
  print(min(kekka))
else:
  print(-1)
# ABC174 E

import math

n, k = map(int, input().split())
a_l = [int(x) for x in input().split()]

left = 0
right = max(a_l)


def cut(len):
    ret = 0
    for i in range(n):
        ret += math.ceil(float(a_l[i] / len)) - 1
    return ret


while (right - left) > 1:
    _q = (left + right) // 2
    _ret = cut(_q)
    if k >= _ret:
        right = _q
    else:
        left = _q

_l = cut(left)
_r = cut(right)

if _l <= k:
    print(left)
else:
    print(right)

### FIXED CODE ###

# ABC174 E

n, k = map(int, input().split())
a_l = [int(x) for x in input().split()]

left = 0
right = max(a_l)


def cut(len):
    ret = 0
    for i in range(n):
        if a_l[i] % len == 0:
            ret += a_l[i] // len - 1
        else:
            ret += a_l[i] // len
    return ret


while (right - left) > 1:
    _q = (left + right) // 2
    _ret = cut(_q)
    if k >= _ret:
        right = _q
    else:
        left = _q

print(right)
from fractions import gcd
# def lcm(a,b): return a*b//gcd(a,b)

def _lcm(a, b):
    _gcd = gcd(a, b)
    return int((a * b) / _gcd)

n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t, ans)
print(ans)

### FIXED CODE ###

from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)

n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t, ans)
print(ans)
import itertools

N,M,Q = map(int,input().split())
li = []

for i in range(Q):
  li.append(list(map(int,input().split())))
li.sort(key = lambda x:x[3])
num = [i for i in range(1,M+1)] 
l = list(itertools.combinations_with_replacement(num, M))
max_sum=-1
for i in range(len(l)):
  s = 0
  for j in range(Q):
    if l[i][li[j][1]-1] -  l[i][li[j][0]-1] == li[j][2]:
      s+= li[j][3]
      
  max_sum = max(max_sum,s)
print(max_sum)
    

### FIXED CODE ###

import itertools

N,M,Q = map(int,input().split())
li = []

for i in range(Q):
  li.append(list(map(int,input().split())))
li.sort(key = lambda x:x[3])
num = [i for i in range(1,M+1)] 
l = list(itertools.combinations_with_replacement(num, N))
max_sum=-1
for i in range(len(l)):
  s = 0
  for j in range(Q):
    if l[i][li[j][1]-1] -  l[i][li[j][0]-1] == li[j][2]:
      s+= li[j][3]
      
  max_sum = max(max_sum,s)
print(max_sum)
import itertools
s = input()
s_li = list(s)
lee = len(s_li)

count = 0
keta = list(itertools.combinations([i for i in range(lee)], 2))
for k in keta:
    lk = list(k)
    #print(s_li[lk[0]:lk[1]+1])
    if int(''.join(s_li[lk[0]:lk[1]+1]))%2019 == 0:
        count += 1
print(count)

### FIXED CODE ###

s,w = map(int,input().split())
if w>=s:
    print('unsafe')
else:
    print('safe')
import queue as q

def main():
    N, M = list(map(int, input().split()))
    D = {}
    for m in range(M):
        u, v = map(int, input().split())
        u -= 1
        v -= 1
        D.setdefault(u, set()).add(v)

    S, T = list(map(int, input().split()))
    S -= 1
    T -= 1
    print(f(D, S, T, N))

def f(D, S, T, N):
    close = [set(), set(), set()]
    Q = [None] * 3 * N
    index = 0
    end = 1
    Q[0] = (S, 0, 0)

    while end > index:
        p, c, l = Q[index]
        index += 1
        if l == 0 and p == T:
            return c
        close[l].add(p)

        ns = D.setdefault(p, set())
        l, c = (l + 1) % 3, c + (l + 1) // 3
        for n in ns:
            if n in close[l]:
                continue
            Q[end] = (n, c, l)
            end += 1
    return -1

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))

def f(D, S, T):
    close = [[False] * N, [False] * N, [False] * N]
    Q = []
    index = 0
    Q.append((S, 0, 0))

    while len(Q) > index:
        p, c, l = Q[index]
        index += 1
        
        if close[l][p]:
            continue
        
        if l == 0 and p == T:
            return c // 3
        close[l][p] = True

        l, c = (l + 1) % 3, c + 1
        for n in D[p]:
            if close[l][n]:
                continue
            Q.append((n, c, l))
    return -1

if __name__ == "__main__":
    D = {n: set() for n in range(N)}
    for m in range(M):
        u, v = map(int, input().split())
        u -= 1
        v -= 1
        D[u].add(v)

    S, T = list(map(int, input().split()))
    S -= 1
    T -= 1

    print(f(D, S, T))
n, q = map(int, input().split(' '))
inf = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split(' '))
    inf[a-1].append(b-1)
    inf[b-1].append(a-1)
score = [0 for _ in range(n)]
visit = [0 for _ in range(n)]
for _ in range(q):
    p, x = map(int, input().split(' '))
    score[p-1] += x
def addp(num):
    if all(visit[x] == 1 for x in inf[num]):
        return 0
    visit[num] = 1
    for i in inf[num]:
        if visit[i] == 0:
            score[i] += score[num]
            addp(i)
    return 0
addp(0)
print(*score)

### FIXED CODE ###

def main():
    n, q = map(int, input().split(' '))
    import sys
    from collections import deque
    sys.setrecursionlimit(10**7)

    visit = [True for _ in range(n)]
    point = [0 for _ in range(n)]
    dic = [[] for _ in range(n)]
    for _ in range(n-1):
        a, b = map(int, input().split(' '))
        dic[a-1].append(b-1)
        dic[b-1].append(a-1)
    for _ in range(q):
        p, x = map(int, input().split(' '))
        point[p-1] += x
    next_visit = deque()
    next_visit.append(0)
    visit[0] = False
    counter = 1
    while counter < n:
        t = next_visit.pop()
        for s in dic[t]:
            if visit[s]:
                point[s] += point[t]
                visit[s] = False
                counter += 1
                next_visit.append(s)
    print(*point)
if __name__ == '__main__':
    main()
import numpy as np
import math

A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

#１の位が0以外でより小さい値のものを最後にする
dishes=np.array([A,B,C,D,E])
dishes_1=np.array(list(map(lambda x: x%10, dishes)))
# print(dishes)
# print(dishes_1)
last=0
ans=0
if np.all(dishes_1==0):
  print("")
else:
  dishes=np.stack([dishes, dishes_1], 1)
  dishes=sorted(dishes, key=lambda x: x[1])
  for i in range(len(dishes)):
      if dishes[i][1]!=0:
          last=dishes[i]
          dishes.pop(i)
          break
  for j in range(len(dishes)):
      ans=ans+dishes[j][0]+((10-dishes[j][0]%10)%10)
  print(ans+last[0])


### FIXED CODE ###

import numpy as np
import math

A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

#１の位が0以外でより小さい値のものを最後にする
dishes=np.array([A,B,C,D,E])
dishes_1=np.array(list(map(lambda x: x%10, dishes)))
# print(dishes)
# print(dishes_1)
last=0
ans=0
if np.all(dishes_1==0):
  print(A+B+C+D+E)
else:
  dishes=np.dstack([dishes, dishes_1])
  dishes=dishes[0]
  dishes=sorted(dishes, key=lambda x: x[1])
  for i in range(len(dishes)):
      if dishes[i][1]!=0:
          last=dishes[i]
          dishes=np.delete(dishes, [i], axis=0)
          break
  for j in range(len(dishes)):
      ans=ans+dishes[j][0]+((10-dishes[j][0]%10)%10)
  print(ans+last[0])
from fractions import Fraction as fa

n = int(input())
arr= [int(x) for x in input().split()]
ans = 0
for i in arr:
  ans += fa(1,i)
  
ans = str(ans).split('/')

print('%0.2f'%(int(ans[1])/int(ans[0])))

### FIXED CODE ###

n = int(input())
arr= [1/int(x) for x in input().split()]
print(1/sum(arr))
import sympy as sp
x=[]
N =int(input())
array=list(map(int, input().split()))
for i in array:
    if i%2==0:
        x.append(sp.factorint(i)[2])
    else:
        x.append(0)
print(min(x))


### FIXED CODE ###

N =int(input())
array=list(map(int, input().split()))

x=[]

for i in array:
    count = 0
    while i%2==0:
        i=i/2
        count = count +1
    x.append(count)
print(min(x))
def main():
    N, K, C = map(int, input().split())
    S = input()

    end = len(S)
    fullbit = (1 << end) - 1

    ans = [None]

    def search(i, bit, cnt):
        if cnt == K:
            if ans[0] is None:
                ans[0] = fullbit
            ans[0] &= bit
            return
        if i >= end:
            return
        search(i + 1, bit, cnt)
        if S[i] == 'x':
            return
        search(i + C + 1, bit | (1 << i), cnt + 1)

    bit = search(0, 0, 0)
    for i in range(N):
        if (ans[0] & (1 << i)) != 0:
            print(i + 1)


main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)


def main():
    N, K, C = map(int, input().split())
    S = input()

    def forward(k):
        i = 0
        day = 0
        days = [-1] * k
        l = len(S)
        while day < k and i < l:
            while S[i] == 'x':
                i += 1
                if i >= l:
                    return None
            days[day] = i
            day += 1
            i += 1 + C
        if day < k:
            return None
        return days

    def backward(k):
        day = k
        days = [-1] * k
        l = len(S)
        i = l - 1
        while day > 0 and i >= 0:
            while S[i] == 'x':
                i -= 1
                if i < 0:
                    return None
            day -= 1
            days[day] = i
            i -= (1 + C)
        if day > 0:
            return None
        return days

    left = forward(K)
    if left is None:
        return

    right = backward(K)
    for i, j in zip(left, right):
        if i == j:
            print(i + 1)

main()