CodeEff/ECCO huggingface dataset:
# Original solution
N=int(eval(input()))
cnt,zero,one,two,three,four,more=0,0,0,0,0,0,0
d=0
A=list(map(int,input().split()))
B=A[:]
for i in range(N):
  while B[i]%2==0:
    if B[i]%2==0:
      B[i]=B[i]//2
      cnt=cnt+1
  if cnt==0:
    zero += 1
  elif cnt==1:
    one += 1
  elif cnt==2:
    two += 1
  elif cnt==3:
    three += 1
  elif cnt==4:
    four += 1
  else:
    more += 1
  cnt=0
#print(zero,one,two,three,four,more)
if one%2==0:
  d=0
else:
  d=1
if (zero+d)>(two+three+four+more+1):
  print("No")
else:
  print("Yes")

# Optimized solution
N=int(eval(input()))
cnt,zero,one,two,more,d=0,0,0,0,0,0
A=list(map(int,input().split()))
B=A[:]
for i in range(N):
  while B[i]%2==0:
    if B[i]%2==0:
      B[i]=B[i]//2
      cnt=cnt+1
  if cnt==0:zero += 1
  elif cnt==1:one += 1
  else:more += 1
  cnt=0
if one%2!=0:d=1
print(("No" if (zero+d)>(two+more+1) else "Yes"))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
num2=0
num4=0
num0=0
for i in a:
    if i%4==0:
        num4+=1
    elif i%2==0:
        num2+=1
    else:
        num0+=1
if num2==0:
    if num0<=num4+1:
        print("Yes")
    else:
        print("No")
else:
    if num0<=num4:
        print("Yes")
    else:
        print("No")

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
b_2=0
b_4=0
b_0=0
for i in a:
    if i%4==0:
        b_4+=1
    elif i%2==0:
        b_2+=1
    else:
        b_0+=1
if b_2==0:
    if b_0<=b_4+1:
        print("Yes")
    else:
        print("No")
else:
    if b_0<=b_4:
        print("Yes")
    else:
        print("No")
# Original solution
n = int(eval(input()))
a_ls = list(map(int, input().split()))
num_mul4 = 0
num_even_not4 = 0
num_odd = 0
for i in range(n):
    if a_ls[i] % 4 == 0:
        num_mul4 += 1
    elif a_ls[i] % 2 == 0:
        num_even_not4 += 1
    else:
        num_odd += 1
res = 'No'
if num_even_not4 == 0:
    if num_odd <= num_mul4 + 1:
        res = 'Yes'
else:
    num_odd += 1
    if num_odd <= num_mul4 + 1:
        res = 'Yes'
print(res)

# Optimized solution
n = int(eval(input()))
a_ls = list(map(int, input().split()))
n_4k = 0
n_2k = 0
n_odd = 0
for i in range(n):
    if a_ls[i] % 4 ==0:
        n_4k += 1
    elif a_ls[i] % 2 ==0:
        n_2k += 1
    else:
        n_odd += 1
res = 'No'
if n_odd == 0:
    res = 'Yes'
else:
    if n_2k > 0:
        if n_odd <= n_4k:
            res = 'Yes'
    else:
        if n_odd <= n_4k+1:
            res = 'Yes'
print(res)
# Original solution
n,*A=list(map(int,open(0).read().split()))
C=[0]*3
for a in A:
    for i in range(2,-1,-1):
        if a%2**i == 0:
            C[i] += 1
            break
print(("Yes"*(C[0]<=C[2]or (C[0]==C[2]+1 and C[1]==0))or"No"))

# Optimized solution
n,*A=list(map(int,open(0).read().split()));p=sum(a%2<1for a in A);q=sum(a%4<1for a in A);print(("Yes"*(q==p>n-p-2or n-p<=q)or"No"))
# Original solution
N=int(eval(input()));A=input().split();v=[int(i)%4for i in A];print(('Yes'if v.count(0)+v.count(2)//2>=N//2 else'No'))

# Optimized solution
N=int(eval(input()));v=[int(i)%4for i in input().split()];print(('Yes'if v.count(0)+v.count(2)//2>=N//2 else'No'))
# Original solution
from sys import stdin
n, *a = list(map(int, stdin.read().split()))
c2, c4 = 0, 0
for i in a:
    if i % 2 == 0: c2 += 1
    if i % 4 == 0: c4 += 1

if c4 >= len(a) // 2: ans = "Yes"
elif (len(a) - c4 * 2) == (c2 - c4): ans = "Yes"
else: ans = "No"

print(ans)

# Optimized solution
from sys import stdin
n, *a = list(map(int, stdin.read().split()))
c2, c4 = 0, 0
for i in a:
    if i % 2 == 0: 
        if i % 4 == 0:
            c4 += 1
        else:
            c2 += 1

if c4 >= len(a) // 2: ans = "Yes"
elif (len(a) - c4 * 2) == c2: ans = "Yes"
else: ans = "No"

print(ans)
# Original solution
import itertools
N = int(eval(input()))
a = list(map(int, input().split()))

ans = 'No'

for i in itertools.permutations(a):
    count = 0
    for j in range(1, len(i)):
        if (i[j-1] * i[j]) % 4 == 0:
            count += 1
        else:
            pass
    if count == N-1:
        ans = 'Yes'
        break

print(ans)

# Optimized solution
N = int(eval(input()))
a = list(map(int, input().split()))

cnt2 = 0  # 2で割り切れる回数
cnt4 = 0  # 4で割り切れる回数

for i in range(N):
    if a[i] % 4 == 0:
        cnt4 += 1
    elif a[i] % 2 == 0:
        cnt2 += 1

if N-max(cnt2-1, 0) <= cnt4*2+1:
    print('Yes')
else:
    print('No')
# Original solution
from math import floor
N = int(eval(input()))
a = list(map(int, input().split()))
cnt_4 = 0
for i in a:
    if i%4==0:
        cnt_4 += 1
        a.remove(i)

cnt_2 = 0
for i in a:
    if i%2==0:
        cnt_2 += 1

if floor(N//2)<=cnt_4+(cnt_2//2):
    print('Yes')
else:
    print('No')

# Optimized solution
from math import floor
N = int(eval(input()))
a = list(map(int, input().split()))
cnt_4 = 0
for i in a:
    if i%4==0:
        cnt_4 += 1

cnt_2 = 0
for i in a:
    if i%2==0 and i%4!=0:
        cnt_2 += 1

if floor(N//2)<=cnt_4+(cnt_2//2):
    print('Yes')
else:
    print('No')
# Original solution
n=int(eval(input()))
a=[int(i) for i in input().split()]

t=0
f=0

for i in a:
    if i%4==0:
        f+=1
    elif i%2==0:
        t+=1

if t==0:
    t=1
if n-t+1<=2*f+1:
    print("Yes")
else:
    print("No")




# Optimized solution
n=int(eval(input()))
a=[int(i) for i in input().split()]
c2=0
c4=0
c=0
for i in a:
    if i%4==0:
        c4+=1
    elif i%2==0:
        c2+=1
    else:
        c+=1

if c==0 or c+c2-1<=c4 or c<=c4:
    print("Yes")
else:
    print("No")
# Original solution
n=int(eval(input()))
A=list(map(int,input().split()))
four=list([x for x in A if x%4==0])
even=list([x for x in A if x%2==0])
odd=list([x for x in A if x%2==1])
# print(len(even))
# print(len(odd))
# print(len(four))

#全ての成分が偶数
if len(even)==len(A):
  print('Yes')
  exit()
#4の倍数が奇数の半分以上ある（切り下げ）かつ2の倍数が偶数個かつ元が偶数個
if len(four)>=len(odd)/2 and (len(even)-len(four))%2==0:
  if (len(even)-len(four))%2>0:
    print('Yes')
    print('aa')
    exit()
# #4の倍数が奇数の半分以上ある（切り上げ）かつ4の倍数が奇数個あるかつ2の倍数が奇数個あるかつ元が奇数個
if len(four)>=len(odd)/2 and len(four)%2!=0 and len(A)%2!=0:
  print('Yes')
  exit()
if len(four)>=len(odd)/2 and len(four)%2==0 and len(A)%2==0:
  print('Yes')
  exit()
else:
  print('No')

# Optimized solution
#強い人のコード
N=int(eval(input()))
ans='Yes'
odd=0
four=0
for x in map(int,input().split()):
    if x%2==1:
        odd+=1
    elif x%4==0:
        four+=1
#4の倍数+1が奇数の数より少ないとダメ
if four+1<odd:
    ans='No'
#4の倍数+1が奇数と同じかつその合計が全体より少ないとダメ（ひとつ奇数が余ることになる）
elif four+1==odd and odd+four<N:
    ans='No'
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
num4 = 0
num1 = 0
for i in a:
    if i % 4 == 0:
        num4 += 1
        continue
    if i % 2 == 1:
        num1 += 1
if num4 >= num1:
    print("Yes")
elif num4 + 1 == num1 and (num4 + num1) % 2 == 1 and n - (num4 + num1) == 0:
    print("Yes")
else:
    print("No")


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
num4 = 0
num1 = 0
for i in a:
    if i % 4 == 0:
        num4 += 1
        continue
    if i % 2 == 1:
        num1 += 1
if num4 >= num1 or num4 + 1 == num1 and (num4 + num1) % 2 == 1 and n - (num4 + num1) == 0:
    print("Yes")
else:
    print("No")
# Original solution
import math
import calendar
import fractions
import itertools

n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in list(itertools.permutations(a)):
    flag = 1
    for j in range(len(i) - 1):
        if i[j] * i[j + 1] % 4 != 0:
            flag = 0
            break
    if flag == 1:
       ans = 1
       break
if ans == 1:
    print("Yes")
else:
    print("No")

# Optimized solution
import math
import calendar
import fractions
import itertools

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

n = int(eval(input()))
a = list(map(int, input().split()))
b = []
ans = 0
for i in a:
    c = i
    cnt = 0
    while c % 2 == 0 and cnt < 2:
        c /= 2
        cnt += 1
    b.append(cnt)
if my_index(b, 1) == False:
    if b.count(2) + 1 >= b.count(0):
        ans = 1
    else:
        ans = 0
else:
    if b.count(2) >= b.count(0):
        ans = 1
    else:
        ans = 0
if ans == 1:
    print("Yes")
else:
    print("No")
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

a = [i%100 if i >100 else i for i in a]
pair = n*(n - 1)/2
not_4 = 0
ans = 'Yes'
num = len(a)
for i in range(num):
  for j in range(num):
    
    if i != j and a[i]*a[j]%4 != 0:
      not_4 += 1
      
      
    if not_4 >= pair:
      ans = 'No'
      break
    
print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))

four = 0
two = 0
one = 0
for i in a:
  if i%4 == 0:
    four += 1
  elif i%2 == 0 and i%4 != 0:
    two += 1
  elif i%2 != 0:
    one += 1

if four >= one or four + 1 >= two//2 + two%2 + one or n == two:
  print('Yes')
else:
  print('No')
# Original solution
N = int(eval(input()))
A = [int(i) for i in input().split()]

ki = 0
gu4 = 0
for i in A:
    if i % 4 == 0:
        gu4 += 1
    elif i % 2 != 0:
        ki += 1

if N % 2 != 0:
    if ki <= gu4 + 1:
        print('Yes')
    else:
        print('No')
else:
    if ki <= gu4:
        print('Yes')
    else:
        print('No')

# Optimized solution
N = int(eval(input()))
a = [int(i) for i in input().split()]

multip4 = 0
unbreakable = 0

for i in a:
    if i % 4 == 0:
        multip4 += 1

    elif i % 2 != 0:
        unbreakable += 1

if N % 2 != 0:
    multip4 += 1

if multip4 >= unbreakable:
    print('Yes')
else:
    print('No')
# Original solution
import itertools
N=int(eval(input()))
A=list(map(int,input().split()))
junretsu=list(itertools.permutations(A))
for j in junretsu:
    cnt=0
    for i in range(N-1):
        if j[i]*j[i+1]%4!=0:
            break
        else:
            cnt+=1
    if cnt==N-1:
        print('Yes')
        exit()
print('No')

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))

div_1,div_2,div_4=0,0,0
for a in A:
    if a%4==0:
        div_4+=1
    elif a%2==0:
        div_2+=1
    elif a%2!=0:
        div_1+=1
if div_2==0 and div_1<=div_4+1:
    print('Yes')
elif div_2>0 and div_1<=div_4:
    print('Yes')
else:
    print('No')
# Original solution
def mp2(k):
    kk=k
    mp=0
    while kk>=1:
        kr=kk%2
        if kr==0:
            kk=kk//2
            mp=mp+1
#            print(kk,kr,mp)
        else:
#            print(kk,kr,mp)
            return mp
    return mp
        

n=int(eval(input()))
a=list(map(int,input().split()))

cnt0=0
cnt1=0
cnt2=0
for i in range(n):
    m=min(2,mp2(a[i]))
    if m==0:
        cnt0=cnt0+1
    elif m==1:
        cnt1=cnt1+1
    elif m==2:
        cnt2=cnt2+1

#print(cnt0,cnt1,cnt2)

if cnt1==0:
    if cnt2>=cnt0-1:
        print("Yes")
    else:
        print("No")
else:
    if cnt2>=cnt0:
        print("Yes")
    else:
        print("No")


# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))

b4=0
b2=0
b1=0
for i in range(n):
    if a[i]%4==0:
        b4+=1
    elif a[i]%2==0:
        b2+=1
    else:
        b1+=1
        
if b2==0:
    if b1<=b4+1:
        print("Yes")
    else:
        print("No")
else:
    if b1<=b4:
        print("Yes")
    else:
        print("No")
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

odds = []
bai4 = []

for i in range(N):
    odds.append(A[i]%2 == 1)
    bai4.append(A[i]%4 == 0)
    
odd = sum(odds)
bi4 = sum(bai4)
bi2 = N - odd - bi4

if odd + bool(bi2) > bi4+1:
    print("No")
else:
    print("Yes")

# Optimized solution
import sys
stdin = sys.stdin

def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = list(li())

mod2 = 0
odd = 0
mod0 = 0

for ai in a:
    if ai%4 == 0:
        mod0 += 1
    elif ai%2 == 0:
        mod2 = 1
    else:
        odd += 1
        
odd += mod2


if mod0 >= (odd-1):
    print("Yes")
else:
    print("No")
# Original solution
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    o, t, f = 0, 0, 0
    for a in A:
        if a % 4 == 0:
            f += 1
        elif a % 2 == 0:
            t += 1
        else:
            o += 1
    if t > 0:
        o += 1
    print(('Yes' if o <= f + 1 else 'No'))


if __name__ == '__main__':
    main()


# Optimized solution
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()

    cnt = 0
    for a in A:
        if a % 4 == 0:
            cnt += 1
        elif a % 2 == 0:
            cnt += .5
    print(('Yes' if N // 2 <= int(cnt) else 'No'))


if __name__ == '__main__':
    main()
# Original solution
_,*l=list(map(int,open(0).read().split()));o=t=0
for i in l: 
	o+=i%2
	t+=(i%4>0)
print(("YNeos"[(t>o)+o>len(l)-t+1::2]))

# Optimized solution
n,*l=list(map(int,open(0).read().split()));o=t=0
for i in l: 
	o+=i%2
	t+=(i%4>0)
print(("YNeos"[(t>o)+o>n-t+1::2]))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
four = 0
two = 0
for i in range(n):
    if a[i] % 4 == 0:
        four += 1
    elif a[i] % 2 == 0:
        two += 1

if four >= n // 2 or n - 2 * four <= two:
    print("Yes")
else:
    print("No")


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
four = 0
two = 0
for i in range(n):
    if a[i] % 4 == 0:
        four += 1
    elif a[i] % 2 == 0:
        two += 1

if 2 * four + 1 >= n:
    print("Yes")
elif 2 * four + two >= n:
    print("Yes")
else:
    print("No")
# Original solution
n = int(eval(input()))
*a, = list(map(int, input().split()))

*b, = [x for x in a if x%4 != 0]
mul_4 = n-len(b)

*c, = [x for x in b if x%2 != 0]
mul_2 = (len(b)-len(c))

k = n-(mul_4+mul_2)

if mul_2 == 0 and k <= mul_4+1:
    print("Yes")
elif k <= mul_4:
    print("Yes")
else:
    print("No")


# Optimized solution
n = int(eval(input()))
*a, = list(map(int, input().split()))

b1 = 0
b2 = 0
b4 = 0
for _a in a:
    if _a%4 == 0:
        b4 += 1
    elif _a%2 == 0:
        b2 += 1
    else:
        b1 += 1

if b2 == 0:
    print(("Yes" if b1 <= b4+1 else "No"))
else:
    print(("Yes" if b1 <= b4 else "No"))
# Original solution
N = int(eval(input()))
src = list(map(int, input().split()))

x1 = x2 = x4 = 0
for a in src:
    if a%2 == 1:
        x1 += 1
    elif a%4 == 0:
        x4 += 1
    else:
        x2 += 1

def solve():
    if x4 >= x1: return True
    if x4 + 1 == x1:
        return x2 == 0
    else: return False

print(('Yes' if solve() else 'No'))


# Optimized solution
N = int(eval(input()))
src = list(map(int,input().split()))

one = sum([1 for a in src if a%2])
four = sum([1 for a in src if a%4==0])
two = N - one - four

print(('Yes' if one <= four or (one == four+1 and two==0) else 'No'))
# Original solution
n,ais = int(input()), list(map(int, input().split()))
import collections
cc = collections.Counter()
for ai in ais:
	if ai % 4 == 0: cc[0] += 1
	elif ai % 2 == 0: cc[1] += 1
	else: cc[2] += 1

q = collections.deque()
while(n):
	if len(q) == 0:
		for u in range(3)[::-1]:
			if cc[u] > 0:
				q.append(u)
				cc[u]-=1
				n -=1
				break
		if len(q) == 0: break
	else:
		if q[-1] == 0:
			if cc[2]:
				q.append(2)
				cc[2]-=1
				n-=1
			elif cc[1]:
				q.append(1)
				cc[1]-=1
				n-=1
			elif cc[0]:
				q.append(0)
				cc[0]-=1
				n-=1
			else:
				break
		elif q[-1] == 2:
			if cc[0] == 0:
				break
			else:
				q.append(0)
				cc[0]-=1
				n-=1
		elif q[-1] == 1:
			if cc[1] > 0:
				q.append(1)
				cc[1]-=1
				n-=1
			else:
				break

print('Yes' if n == 0 else 'No')


# Optimized solution

import collections
n,ais = int(input()), list(map(int, input().split()))
cc = collections.Counter()
for ai in ais:
	if ai % 4 == 0: cc[0] += 1
	elif ai % 2 == 0: cc[1] += 1
	else: cc[2] += 1

q,h = collections.deque([0]), [[2,1,0],[1],[0]] 
while(n):
	b = False
	for u in h[q[-1]] + [-1]:
		if u == -1: b = True
		if cc[u] > 0:
			q.append(u)
			q.popleft()
			cc[u] -=1
			n -=1
			break
	if b: break

print('Yes' if n == 0 else 'No')
# Original solution
def main(N, aa):
    """
    a_i * a_(i+1) = 4k
        i=2n and i+1=2m
        i=4n or  i+1=4m

    half: 4m -> ok
    all: 2n -> ok

    example5
        2 7 1 8 2 8
          -     -
        2 2 1 8 7 8
    all2を作成
    残りhalfのパターン

    example2
        1 2 3 4
        2 1 3 4
          1 3 4

        all2, 最後の１つは２＊２にならないので以下でフォロー
        2, 4m, x, 4m
        2, 4m, x, 4m, x
    """
    n_m2 = 0
    n_m4 = 0
    n_m2_notm4 = 0
    for a in aa:
        is_m2 = a % 2 == 0
        is_m4 = a % 4 == 0

        n_m2 += int(is_m2)
        n_m4 += int(is_m4)
        n_m2_notm4 += int(is_m2 and not is_m4)

    if n_m2 == N:
        return "Yes"
    elif n_m2_notm4 == 0 and n_m4 >= N // 2:
        return "Yes"
    else:
        rest = N - n_m2_notm4 + 1
        if n_m4 >= rest // 2:
            return "Yes"
        else:
            return "No"


if __name__ == '__main__':
    N = int(eval(input()))
    aa =list(map(int, input().split()))

    print((main(N, aa)))


# Optimized solution
def main(N, aa):
    """
    a_i * a_(i+1) = 4k
        i=2n and i+1=2m
        i=4n or  i+1=4m

    half: 4m -> ok
    all: 2n -> ok

    example5
        2 7 1 8 2 8
          -     -
        2 2 1 8 7 8
    all2を作成
    残りhalfのパターン

    example2
        1 2 3 4
        2 1 3 4
          1 3 4

        all2, 最後の１つは２＊２にならないので以下でフォロー
        2, 4m, x, 4m
        2, 4m, x, 4m, x
    """
    n_m2 = 0
    n_m4 = 0
    n_m2_notm4 = 0
    for a in aa:
        is_m2 = a % 2 == 0
        is_m4 = a % 4 == 0

        n_m2 += int(is_m2)
        n_m4 += int(is_m4)
        n_m2_notm4 += int(is_m2 and not is_m4)

    if n_m2_notm4 == 0 and n_m4 >= N // 2:
        return "Yes"
    else:
        rest = N - n_m2_notm4 + 1
        if n_m4 >= rest // 2:
            return "Yes"
        else:
            return "No"


if __name__ == '__main__':
    N = int(eval(input()))
    aa = list(map(int, input().split()))

    print((main(N, aa)))
# Original solution
n = int(eval(input()))
a = [int(i) for i in input().split()]

count1 = 0
count2 = 0
count3 = 0
for i in range(n):
    if a[i] % 2 == 0 and a[i] % 4 != 0:
        count1 += 1
    elif a[i] % 4 == 0:
        count2 += 1
    else:
        count3 += 1

#print(count1, count2, count3)

if count2 >= n // 2:
    print("Yes")
elif count2 >= (n - 2 * (count1 // 2)) // 2:
    print("Yes")
else:
    print("No")


# Optimized solution
n = int(eval(input()))
a = [int(_) % 4 for _ in input().split()]
e, f = a.count(2), a.count(0)
print((["No", "Yes"][f >= (n - 2 * (e // 2)) // 2]))
# Original solution
n=int(eval(input()))
a=list(map(int, input().split()))
i=0
odd=0
even=0
eveneven=0
while i<n:
    if a[i]%4==0:
        eveneven+=1
    elif a[i]%2==0:
        even+=1
    else:
        odd+=1
    i+=1    
if even==0 and eveneven>=(odd-1):
    print("Yes")
elif even!=0 and eveneven>=odd:
    print("Yes")
else:
    print("No")

# Optimized solution
# whileだと実行時間83msだったけどforでは？
n=int(eval(input()))
a=list(map(int, input().split()))
i=0
odd=0
even=0
eveneven=0
for i in a:
    if i%4==0:
        eveneven+=1
    elif i%2==0:
        even+=1
    else:
        odd+=1  
if even==0 and eveneven>=(odd-1):
    print("Yes")
elif even!=0 and eveneven>=odd:
    print("Yes")
else:
    print("No")
# Original solution
_ = eval(input())
a = [int(x) for x in input().split()]

odd = []
m4 = []
m2 = 0
for i in a:
    if i % 2 != 0:
        odd.append(i)
    elif i % 4 == 0:
        m4.append(i)
    else:
        m2 = 1
else:
    if len(odd) + m2 - 1 <= len(m4):
        print("Yes")
    else:
        print("No")

# Optimized solution
_ = eval(input())
a = [int(x) for x in input().split()]

odd, m4, m2 = 0, 0, 0
for i in a:
    if i % 2 != 0:
        odd += 1
    elif i % 4 == 0:
        m4 += 1
    else:
        m2 = 1
else:
    if odd + m2 - 1 <= m4:
        print("Yes")
    else:
        print("No")
# Original solution
n = int(eval(input()))
A = [int(i) for i in input().split()]

m4 = 0
even = 0
for i in range(n):
    if A[i] % 4 == 0:
        m4 += 1
    if A[i] % 2 == 0:
        even += 1
        
if m4 >=  n // 2 or even == n or (n - even) == m4:
    print('Yes')
else:
    print('No')

# Optimized solution
N = int(eval(input()))
A = [int(i) for i in input().split()]

cnt = 0
cnt2 = 0
for i in range(N):
    if A[i] % 4 == 0:
        cnt += 1
    elif A[i] % 2 == 0:
        cnt2 += 1
    
ans = 'No'
if cnt2 % 2 == 0:
    if cnt >= (N - cnt2) // 2:
        ans = 'Yes'
else:
    if cnt >= (N - cnt2 + 1) // 2:
        ans = 'Yes'
        
print(ans)
# Original solution
N = int(eval(input()))
n = list(map(int, input().split()))

fourEven = 0
odd = 0
otherEven = 0
for num in n:
    if num % 4 == 0:
        fourEven += 1
    elif num % 2 == 1:
        odd += 1
    else:
        otherEven += 1

# print(len(n) == fourEven + otherEven + otherEven)

if len(n) // 2 <= fourEven:
    print('Yes')
elif odd <= fourEven:
    print('Yes')
else:
    print('No')

# Optimized solution
N = int(eval(input()))
n = list(map(int, input().split()))

fourEven = 0
odd = 0
for num in n:
    if num % 4 == 0:
        fourEven += 1
    elif num % 2 == 1:
        odd += 1

if len(n) // 2 <= fourEven or odd <= fourEven:
    print('Yes')
else:
    print('No')
# Original solution
from collections import Counter
from itertools import takewhile

n = int(eval(input()))
vvv = list(map(int, input().split()))
cnt1 = Counter(vvv[0::2])
cnt2 = Counter(vvv[1::2])
mc1 = cnt1.most_common()
mc2 = cnt2.most_common()
mcs1 = list(takewhile(lambda x: x[1] == mc1[0][1], mc1))
mcs2 = list(takewhile(lambda x: x[1] == mc2[0][1], mc2))
if len(mcs1) == len(mcs2) and mcs1[0][0] == mcs2[0][0]:
    if len(mc1) > 1:
        if len(mc2) > 1:
            print((min(n - mc1[0][1] - mc2[1][1], n - mc1[1][1] - mc2[0][1])))
        else:
            print((min(n - mc1[0][1], n - mc1[1][1] - mc2[0][1])))
    else:
        if len(mc2) > 1:
            print((min(n - mc1[0][1] - mc2[1][1], n - mc2[0][1])))
        else:
            print((min(n - mc1[0][1], n - mc2[0][1])))
else:
    print((n - mc1[0][1] - mc2[0][1]))


# Optimized solution
from collections import Counter

n = int(eval(input()))
vvv = list(map(int, input().split()))
cnt1 = Counter(vvv[0::2])
cnt2 = Counter(vvv[1::2])
mc1 = cnt1.most_common(2)
mc2 = cnt2.most_common(2)
if mc1[0][0] == mc2[0][0]:
    sc1 = mc1[1][1] if len(mc1) > 1 else 0
    sc2 = mc2[1][1] if len(mc2) > 1 else 0
    print((min(n - mc1[0][1] - sc2, n - sc1 - mc2[0][1])))
else:
    print((n - mc1[0][1] - mc2[0][1]))