Problem:
 Score : 400 points    Problem Statement We have a sequence of length N , a = (a_1, a_2, ..., a_N) .
Each a_i is a positive integer.  Snuke's objective is to permute the element in a so that the following condition is satisfied:   For each 1 ≤ i ≤ N - 1 , the product of a_i and a_{i + 1} is a multiple of 4 .   Determine whether Snuke can achieve his objective.      Constraints  2 ≤ N ≤ 10^5  a_i is an integer.  1 ≤ a_i ≤ 10^9         Input Input is given from Standard Input in the following format:  N  a_1  a_2  ...  a_N       Output If Snuke can achieve his objective, print Yes ; otherwise, print No .        Sample Input 1 3
1 10 100      Sample Output 1 Yes  One solution is (1, 100, 10) .       Sample Input 2 4
1 2 3 4      Sample Output 2 No  It is impossible to permute a so that the condition is satisfied.       Sample Input 3 3
1 4 1      Sample Output 3 Yes  The condition is already satisfied initially.       Sample Input 4 2
1 1      Sample Output 4 No       Sample Input 5 6
2 7 1 8 2 8      Sample Output 5 Yes

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    if a[i] % 4 == 0:
        a[i] = 2
    elif a[i] % 2 == 0:
        a[i] = 1
    else:
        a[i] = 0

two = a.count(2)
one = a.count(1)
zero = a.count(0)
if two >= n // 2:
    print("Yes")
else:
    if n - two * 2 == one:
        print("Yes")
    else:
        print("No")

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
cnt_1=0
cnt_2=0
cnt_4=0
for i in range(n):
  if a[i]%2 !=0:
    cnt_1 +=1 
  elif a[i]%4 !=0 :
    cnt_2 +=1
  else:
    cnt_4 +=1
    
if cnt_2==0:
  if cnt_4>=cnt_1-1:
    print("Yes")
  else:
    print("No")
else:
  if cnt_4>=cnt_1:
    print("Yes")
  else:
    print("No")

Solution (Python):
from sys import stderr, setrecursionlimit
setrecursionlimit(2147483647)
def getint():
    return int(input())
def getints():
    return [int(i) for i in input().split()]
def getintlines(n=1):
    res = []
    for _ in range(n):
        res.append(getint())
    return res
def getintslines(n=1):
    res = []
    for _ in range(n):
        res.append(getints())
    return res
def debug(*args, **kwargs):
    print(*args, file=stderr, **kwargs)

n = getint()
a = getints()

twice = list(filter(lambda x:x%4==2, a))
quad = list(filter(lambda x:x%4==0, a))

if len(quad) >= n//2:
    print("Yes")
elif len(twice) + 2*len(quad) >= n:
    print("Yes")
else:
    print("No")

Solution (Python):
import math

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

mul_num = 0
two_num = 0
other_num = 0

for i in A:
    if i % 4 == 0:
        mul_num += 1
    elif i % 2 == 0:
        two_num += 1
    else:
        other_num += 1

if mul_num + two_num//2 >= N // 2:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

B = [a%4 for a in A]
four = B.count(0)
two = B.count(2)

if(four + two//2 >= N//2):
  print("Yes")
else:
  print("No")

Solution (Python):
import numpy as np
n, a = int(input()), np.array(list(map(int,input().split())))
odd, div4 = len(np.where(a%2==1)[0]), len(np.where(a%4==0)[0])
ans = "Yes" if (n%2==0 and odd <= div4) or (n%2==1 and ((odd-1==div4 and odd+div4==n) or div4 >= odd)) else "No"
print(ans)

Solution (Python):
import numpy as np
n, a = int(input()), np.array(list(map(int,input().split())))
odd, div2, div4 = len(np.where(a%2==1)[0]), len(np.where((a%2==0) & (a%4!=0))[0]), len(np.where(a%4==0)[0])
ans = "Yes" if (n%2==0 and odd <= div4) or (n%2==1 and ((odd-1==div4 and odd+div4==n) or div4 >= odd)) else "No"
print(ans)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
odd=0
m2=0
m4=0
for n in a:
    if n%2==1:
        odd+=1
    elif n%4!=0:
        m2+=1
    else:
        m4+=1
if m4>=odd or (m2==0 and m4>=odd-1):
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=[1 for i in a if i%4==0]
c=[1 for i in a if i%4!=0 and i%2==0]
print("Yes" if len(b)+len(c)//2>=n//2 else "No")

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
c1 = 0
c2 = 0
c3 = 0
for i in a:
    if i%4==0:
        c1 += 1
    elif i%2==0:
        c2 += 1
    else:
        c3 += 1
if c2==0:
    if c1+1>=c3:
        print("Yes")
    else:
        print("No")
else:
    if c1>=c3:
        print("Yes")
    else:
        print("No")

Solution (Python):



















from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np


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

f_cnt = 0
t_cnt = 0
o_cnt = 0

for ai in a:
    if ai%4 == 0:
        f_cnt += 1
    elif ai%2 == 0:
        t_cnt += 1
    else:
        o_cnt += 1

if t_cnt == 0:
    if f_cnt+1>=o_cnt:
        print("Yes")
    else:
        print("No")
else:
    if f_cnt>=o_cnt:
        print("Yes")
    else:
        print("No")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = {1: 0, 2: 0, 4: 0}
for i in a:
    if i % 2:
        b[1] += 1
    else:
        if (i // 2) % 2:
            b[2] += 1
        else:
            b[4] += 1
if b[1] + b[2] - 1 <= b[4]:
    print("Yes")
    exit()
if b[1] <= b[4]:
    print("Yes")
    exit()
print("No")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = {1: 0, 2: 0, 4: 0}
for i in a:
    if i % 2:
        b[1] += 1
    else:
        if (i // 2) % 2:
            b[2] += 1
        else:
            b[4] += 1
if b[1] + b[2] - 1 <= b[4]:
    print("Yes")
    exit()
if b[1] <= b[4]:
    print("Yes")
    exit()
if b[1] == 0:
    print("Yes")
    exit()
print("No")

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
c=0
d=0
for i in range(n):
    if a[i]%4==0:
        c+=1
    if a[i]%2!=0:
        d+=1
else:
    if (n%2==1 and c==n//2) or c>=d:
        print("Yes")
    else:
        print("No")

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
for i in range(n):
  if A[i]%4==0:
    A[i]=0
  elif A[i]%2==0:
    A[i]=2
  else:
    A[i]=1

a=A.count(0)
b=A.count(2)
c=A.count(1)
if c<=a :
  print("Yes")
elif b==0 and c==a+1:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
amod4 = [0,0,0,0]
for i in range(N):
    if a[i]%4 == 0:
        amod4[0]+=1
    elif a[i]%4 == 1:
        amod4[1]+=1
    elif a[i]%4 == 2:
        amod4[2]+=1
    else:
        amod4[3]+=1
if amod4[1]+amod4[3] <= amod4[0]:
    print("Yes")
elif amod4[1]+amod4[3] == amod4[0]+1 and amod4[2] == 0:
    print("Yes")
else:
    print("No")

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

even = len(list(filter(lambda x: x % 2 == 0, A)))
even2 = len(list(filter(lambda x: x % 4 == 0, A)))
odd = N-even
ans = "No"
if even == N:
    ans = "Yes"
if even-even2 == 0:
    if odd <= even2+1:
        ans = "Yes"
else:
    if odd <= even2:
        ans = "Yes"
print(ans)

Solution (Python):
from collections import Counter as cntr

n = int(input())
*a, = map(lambda x: x % 4, map(int, input().split()))
d = cntr(a)
c0, c1, c2 = d[1]+d[3], d[2], d[0]
if c1:
    print("Yes" if c2 >= c0 else "No")
else:
    print("Yes" if c2 >= c0-1 else "No")

Solution (Python):
def solve():
    N = int(input())
    a = [int(x) for x in input().split()]

    N4 = sum(map(lambda x: x%4==0, a))
    N2 = sum(map(lambda x: x%2==0 and x%4!=0, a))
    N1 = sum(map(lambda x: x%2!=0, a))
    assert N1+N2+N4==N

    return N1 <= N4 or (N4==N1-1 and N2==0)


def main():
    ans = solve()
    if ans:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

B = [a%4 for a in A]
refour = B.count(0)
retwo = B.count(2)

if(refour + retwo//2 >= N//2):
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
four, two, odd = 0, 0, 0
for a in A:
    if a%4 == 0:
        four += 1
    elif a%2 == 0:
        two += 1
    else:
        odd += 1
result = 'Yes' if four + 1 >= odd + bool(two) else 'No'
print(result)

Solution (Python):

def solve(N, As):
    
    n4 = len([n for n in As if n % 4 == 0])
    n2 = len([n for n in As if n % 4 != 0 and n % 2 == 0])
    n0 = len([n for n in As if n % 2 != 0])
    if n2 >= 2:
        return "Yes" if n4 >= n0 else "No"
    else:
        return "Yes" if (n4 + 1) >= (n0 + n2) else "No"


if __name__ == "__main__":
    N = int(input())
    As = list(map(int, input().split(" ")))
    print(solve(N, As))

Solution (Python):
n = int(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')

Solution (Python):

def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()

n=I()
a=IL()
ans="No"
a2=0
a4=0
for i in range(n):
    if a[i]%4==0:
        a4+=1
    elif a[i]%2==0:
        a2+=1
if 2*a4+a2>=n:
    ans="Yes"
if 2*a4+1>=n:
    ans="Yes"
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

len_1 = len([a for a in A if a % 2 == 1])
len_4 = len([a for a in A if a % 4 == 0])

if len_1 <= len_4:
    print('Yes')
elif len_1 + len_4 == len(A) and len_1 == len_4 + 1:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = list(map(int,input().split()))

cnt0,cnt1,cnt2 = 0,0,0

for i in range(n):
    if a[i]%4 == 0:
        cnt2 += 1
    elif a[i]%2 == 0:
        cnt1 += 1
    else:
        cnt0 += 1

if cnt1 == 0:
    if cnt0 - cnt2 <= 1:
        print('Yes')
    else:
        print('No')
else:
    if cnt0 - cnt2 <= 0:
        print('Yes')
    else:
        print('No')

Solution (Python):
a = int(input())
c = list(map(int,input().split()))
c1=c2=c4=0
for i in c:
    if i%2==1:
        c1+=1
    elif i%4==0:
        c4+=1
    else:c2+=1
if c1+c2-c4==1:print("Yes")
elif c1<=c4:print("Yes")
else:print("No")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

cnt4 = 0
cnt2 = 0
for a in A:
    if a % 4 == 0:
        cnt4 += 1
    elif a % 2 == 0:
        cnt2 += 1

if cnt2 == 0:
    cnt2 = 1
m = cnt4*2+1 + cnt2-1
if m < N:
    print('No')
else:
    print('Yes')

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b1, b2, b4 = 0, 0, 0
for i in a:
    if i%4 == 0:
        b4 += 1
    elif i%2 == 0:
        b2 += 1
    else:
        b1 += 1
if b2 > 0:
    b1 += 1
if b1 <= b4+1:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
cou_4 = 0
cou_2 = 0

for i in range(n):
    a = A[i]
    if a % 4 == 0:
        cou_4 += 1
    elif a % 2 == 0:
        cou_2 += 1
        
if cou_2 == 0 and cou_4 > 0:
    cou_2 += 1
if n <= 2*cou_4 + cou_2:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

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

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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
odd = 0
even4 = 0
for i in A :
    if not i % 4 :
        even4 += 1
    elif i % 2 :
        odd += 1
if (odd <= even4) or (N//2 <= even4) :
    ans = "Yes"
else :
    ans = "No"
print(ans)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
odd = 0
even2 = 0
even4 = 0
for i in A :
    if not i % 4 :
        even4 += 1
    elif not i % 2 :
        even2 += 1
    else :
        odd += 1

if (odd <= even4) or (N//2 <= even4) :
    ans = "Yes"
else :
    ans = "No"

print(ans)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
c_4 = 0
c_2 = 0
c_O = 0
for e in a:
    if e % 4 == 0:
        c_4 += 1
    elif e % 2 == 0:
        c_2 += 1
    else:
        c_O += 1
if c_2 > 0:
    c_O += 1
if c_O <= c_4 + 1:
    ans = "Yes"
else:
    ans = "No"
print(ans)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
two=four=0
for i in l:
    if i%4==0:four+=1
    elif i%2==0:two+=1
print("Yes" if two==n or four>=n//2 or two+2*four>=n else "No")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
n4 = 0
n2 = 0
for i in a:
    if i % 4 == 0:
        n4 += 1
    elif i % 2 == 0:
        n2 += 1
if n%2==0:
    n -= 2*n4
    n -= n2
    if n <= 0:
        print('Yes')
    else:
        print('No')
else:
    n-=2*n4
    if n<=1:
        print('Yes')
    else :
        n -= n2
        if n <= 0:
            print('Yes')
        else:
            print('No')

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
num4 = 0;num2 = 0
for i in range(n):
    if a[i] % 4 == 0:
        num4 += 1
        continue
    elif a[i] % 2 == 0:
        num2 += 1
num2 = num2 // 2
if n // 2 <= num4 + num2:print('Yes')
else:print('No')

Solution (Python):
n = int(input())
a = list(int(i) for i in input().split()) 

a2n = 0
a4n = 0
for i in range(n):
 if a[i]%2 == 0:
  if a[i]%4 == 0:
   a4n += 1
  else:
   a2n += 1


if n > 2 and a4n >0:
 pos = 2 * a4n +1 + 2*(a2n//2)
elif n >= 2 and a4n == 0:
 pos = 2*(a2n//2)


if n <= pos:
 ans ='Yes'
else:
 ans = 'No'

print(ans)

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]

x4count = 0
x2count = 0
for i,x in enumerate(a):
    if x % 4 == 0:
        x4count += 1
    elif x % 2 == 0:
        x2count += 1


if x2count > 0:
    N = N - x2count + 1

if x4count >= N//2:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(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")

Solution (Python):
N = int(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')

Solution (Python):
N = int(input())
arr = list(map(int,input().split()))

a=[]
b=[]
c=[]
for i in range(N):
    if arr[i]%4 == 0:
        a.append(arr[i])
    elif arr[i]%2 == 0:
        b.append(arr[i])
    else:
        c.append(arr[i])
if len(c) > len(a)+1:
    print('No')
elif len(c) < len(a) + 1:
    print('Yes')
elif len(b)%2 == 1:
    print('No')
else:
    print('Yes')

Solution (Python):
def abc069_c():
    n = int(input())
    a = list(map(int, input().split()))
    two = 0
    four = 0
    odd = 0
    for v in a:
        if v % 2 == 0:
            if v % 4 == 0:
                four += 1
            else:
                two += 1
        else:
            odd += 1

    if four >= odd or (four + odd == n and odd - four == 1):
        print("Yes")
    else:
        print("No")


abc069_c()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

cnt2 = cnt4 = 0
for i in a:
    if i % 2 == 0:
        if i % 4 != 0:
            cnt2 += 1
        else:
            cnt4 += 1

if cnt2:
    if ((n-cnt2+1)//2) <= cnt4:
        print('Yes')
    else:
        print('No')
else:
    if (n-cnt2)//2 <= cnt4:
        print('Yes')
    else:
        print('No')

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

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

if cnt2:
    if ((n-cnt2+1)//2) <= cnt4:
        print('Yes')
    else:
        print('No')
else:
    if (n-cnt2)//2 <= cnt4:
        print('Yes')
    else:
        print('No')

Solution (Python):
N,*A=map(int,open(0).read().split());a=sum(x%4<1for x in A);print('YNeos'[a+(sum(x%2<1for x in A)-a)//2<N//2::2])

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
b4 = b2 = 0
for x in A:
    if x % 4 == 0:
        b4 += 1
    elif x % 2 == 0:
        b2 += 1
print('Yes' if b4 + b2 // 2 >= N // 2 else 'No')

Solution (Python):
N = int(input())
a = map(int, input().split())
memo = [0,0,0]
for i in a:
    if i%4 == 0:
        memo[2] += 1
    elif i%2 == 0:
        memo[1] += 1
    else: memo[0] += 1
 
if memo[2]*2+1 >= N or memo[2]*2 + memo[1] >= N:
    print('Yes')
else:print('No')

Solution (Python):
N = int(input())
a = [int(e) for e in input().split()]

mul4 = len([e for e in a if e % 4 == 0])
mul2 = len([e for e in a if e % 2 == 0])

if mul4 >= N // 2 or mul2 == N or mul2 - mul4 >= N - mul4 * 2:
    print('Yes')
else:
    print('No')

Solution (Python):
def main():
    n = int(input())
    aa = list(map(int, input().split()))
    counts = [0] * 3
    for a in aa:
        if a % 4 == 0:
            counts[2] += 1
        elif a % 2 == 0:
            counts[1] += 1
        else:
            counts[0] += 1
    if counts[0] <= counts[2] or counts[0] == counts[2] + 1 and counts[1] == 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
cnt4 = 0
cnto = 0
for i in range(n):
	if a[i]%4==0:
		cnt4 += 1
	if a[i]%2==1:
		cnto += 1
print("Yes" if (cnt4+cnto==n and cnt4+1>=cnto) or cnt4>=cnto else "No")

Solution (Python):
n=input()
a=[(int(i)%4==0)+(int(i)%2==0) for i in input().split()]
b=a.count(0)-a.count(2)
print(["No","Yes"][b<=0 or (b==1 and a.count(1)==0)])

Solution (Python):
N = int(input())
A = list(map(int, input().split(" ")))

two = 0
one = 0
zero = 0
for a in A:
	if a%4 == 0:
		two += 1
	elif a%2 == 0:
		one += 1
	else:
		zero += 1

print("Yes" if zero <= two+(one==0) else "No")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

p = []
q = []
r = []

for i in range(n):
    if a[i] % 4 == 0:
        p.append(a[i])
    elif a[i] % 2 == 0:
        q.append(a[i])
    else:
        r.append(a[i])

s = len(p)
t = len(q)
u = len(r)

if t == 0:
    if u <= s + 1:
        print("Yes")
    else:
        print("No")
else:
    if u <= s:
        print("Yes")
    else:
        print("No")

Solution (Python):

N=int(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

if four+1<odd:
    ans='No'

elif four+1==odd and odd+four<N:
    ans='No'
print(ans)

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
four=list(filter(lambda x:x%4==0,A))
even=list(filter(lambda x:x%2==0,A))
odd=list(filter(lambda x:x%2==1,A))





if len(even)==len(A):
  print('Yes')
  exit()

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()

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')

Solution (Python):
n=int(input())
a=list(map(int,input().split()));tmp=[i%4 for i in a]
four=tmp.count(0)
two=tmp.count(2)
print(["No","Yes"][(four+two//2)>=len(a)//2])

Solution (Python):
N = int(input())

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

cnt2 = 0
cnt4 = 0

for a in A:
    if a % 4 == 0:
        cnt4 += 1
    elif a % 2 == 0:
        cnt2 += 1

cnt2_2 = cnt2 // 2 * 2

if (cnt2_2 + cnt4*2+1) >= N or  cnt2 == N:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = [int(_) for _ in input().split()]
count_odd = 0
count_4 = 0
count_2 = 0
for a in A:
    if a % 4 == 2:
        count_2 += 1
    elif a % 4 == 0:
        count_4 += 1
    else:
        count_odd += 1
if count_odd == count_4+1 and count_2 == 0 or count_odd <= count_4:
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(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
if four+1<odd:
    ans='No'
elif four+1==odd and odd+four<N:
    ans='No'
print(ans)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]







table = [0 for i in range(3)]  
for i in range(n):
    if a[i] % 4 == 0:
        table[0] += 1
    elif a[i] % 4 == 2:
        table[1] += 1
    else:
        table[2] += 1
if table[0] < table[2] - 1:
    print("No")
elif table[0] == table[2] - 1 and table[1] != 0:
    print("No")
else:
    print("Yes")

Solution (Python):
n = int(input())






count4 = 0
count2 = 0
count_odd = 0
num_list = list(map(int, input().split()))
for i in num_list:
    if i % 4 == 0:
        count4 += 1
    elif i % 4 == 2:
        count2 += 1
    if i % 2 == 1:
        count_odd += 1
if count2 >= 1:
    real_count2 = 1
else:
    real_count2 = 0    
if count_odd == 0:
    print("Yes")
else:
    if count4 >= count_odd + real_count2 - 1:
        print("Yes")    
    else:
        print("No")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
c4 = 0
c2 = 0
for i in range(n):
    if a[i] % 4 == 0:
        c4 += 1
    elif a[i] % 2 == 0:
        c2 += 1

d4 = n // 2
d2 = 0
if n % 2 == 0:
    if c4 >= n // 2:
        print("Yes")
        exit()
    else:
        for i in range(n // 2):
            if i == 0:
                d4 -= 1
                d2 += 2
            elif i == n // 2 - 1:
                d4 -= 1
                d2 += 2
            else:
                d4 -= 1
                d2 += 2
            if c4 >= d4 and c2 >= d2:
                print("Yes")
                exit()
else:
    if c4 >= n // 2:
        print("Yes")
        exit()
    else:
        for i in range(n // 2):
            if i == 0:
                d4 -= 1
                d2 += 3
            elif i == n // 2 - 1:
                d4 -= 1
                d2 += 2
            else:
                d4 -= 1
                d2 += 2
            if c4 >= d4 and c2 >= d2:
                print("Yes")
                exit()
print("No")

Solution (Python):
n = int(input())
a_list = list(map(int,input().split()))

divs = [a%4 for a in a_list]
mp_of_four = divs.count(0)
mp_of_two  = divs.count(2) 

if mp_of_four+mp_of_two//2 >= n//2:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(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')

Solution (Python):
def main():
    N = int(input())
    A = map(int, input().split(" "))
    x4 = 0
    x2 = 0
    x1 = 0
    for a in A:
        if a % 4 == 0:
            x4 += 1
        elif a % 2 == 0:
            x2 += 1
        else:
            x1 += 1
    maxlen = x4 * 2 + x2
    if x4 >= 1 and x2 == 0:
        maxlen += 1
    if maxlen >= N:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

divide_4_cnt = 0
divide_2_cnt = 0
for n in A:
    if n % 4 == 0:
        divide_4_cnt += 1
    elif n % 2 == 0:
        divide_2_cnt += 1
divide_2_cnt = (divide_2_cnt // 2) * 2
N = N - divide_2_cnt

if N//2 <= divide_4_cnt:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
a=0
b=0
for i in l:
    if i%4==0:
        a+=1
    if i%2==0:
        b+=1
b=b-a
if n<=2*a+1:
    print('Yes')
elif (n-2*a)<=b:
    print('Yes')
else:
    print('No')

Solution (Python):
a = int(input())
ar = list(map(int,input().split()))
k = 0
g = 0
f = 0
for r in ar:
    if r % 4 == 0:
        f += 1
    elif r % 2 == 0:
        g += 1
    else:
        k += 1
if f == 0:
    if k == 0:
        print("Yes")
    else:
        print("No")
elif g == 0:
    if k - f <= 1:
        print("Yes")
    else:
        print("No")
elif k == 0:
    print("Yes")
else:
    if f >= k:
        print("Yes")
    else:
        print("No")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

f = 0
d = 0
for x in a:
    if x % 4 == 0:
        f += 1
    elif x % 2 == 0:
        d += 1

if 0 < d < n:
    d -= 1

if n > f * 2 + 1 + d:
    print('No')
else:
    print('Yes')

Solution (Python):
N = int(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
zero = N - two - four
if zero == four + 1:
    if two == 0:
        print("Yes")
    else:
        print("No")
elif zero > four:
    print("No")
else:
    print("Yes")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

mapa = {4:0, 2:0, 1:0}

for i in a:
    if i % 4 == 0:
        mapa[4] += 1
    elif i % 2 == 0:
        mapa[2] += 1
    else:
        mapa[1] += 1
if mapa[2] > 0:
    mapa.pop(2)
    mapa[1] += 1
if mapa[1] > mapa[4] + 1:
    print('No')
else:
    print('Yes')

Solution (Python):
import sys
def 解():
    input = sys.stdin.readline
    iN = int(input())
    m4,m2,m1 = 0,0,0

    def fp():
        print("Yes")
    def fn():
        print("No")
    for a in input().split():
        a = int(a)
        if a % 4 ==0:
            m4 += 1
        elif a % 2 == 0:
            m2 += 1
        else:
            m1 += 1
    if m2 :
        if m1 <= m4:
            fp()
        else:
            fn()
    else:
        if m1 <= m4 + 1:
            fp()
        else:
            fn()
解()

Solution (Python):
n = int(input())
a = list(map(int,input().split()))

b = [i%4 for i in a]
four = b.count(0)
two = b.count(2)
if four + two//2 >= len(a)//2:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

ans = 0
for a in A:
    if a % 4 == 0:
        ans += 1
    elif a % 2 != 0:
        ans -= 1
if N % 2 != 0:
    ans += 1
print('Yes' if ans >= 0 else 'No')

Solution (Python):
import collections

def per4_2(x):
	if x % 4 == 0:
		return 4
	elif x % 2 == 0 and x % 4 != 0:
		return 2
	else:
		return 1


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

a = list(map(per4_2,a))


a_c=collections.Counter(a)

ans = 'No'

if a_c[2] == 0:
	if a_c[4]>=a_c[1]-1:
		ans = 'Yes'
else:
	if a_c[4] >=a_c[1]:
		ans = 'Yes'
print(ans)

Solution (Python):


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

nodd = 0
neven = 0
n4 = 0

for i in range(0,n):
  if a[i]%4==0:
    n4=n4+1
  elif a[i]%2==0:
    neven=neven+1
  else:
    nodd=nodd+1

res = 'No'

if neven==0 and n4+1 >= (nodd):
  res = 'Yes'
elif n4+1 >= (nodd+1):
  res = 'Yes'
elif nodd==0:
  res = 'Yes'

print(res)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
i,j,k=0,0,0
for m in a:
    if m%4==0:
        i+=1
    elif m%2==0:
        j+=1
    else:
        k+=1
if j==0:
    if i>=k-1:
        print('Yes')
    else:
        print('No')
else:
    if i>=k:
        print('Yes')
    else:
        print('No')

Solution (Python):

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

m4 = []
m2 = []
mo = []

for a in an:
    if a%4 == 0:
        m4.append(a)
    elif a%2 == 0:
        m2.append(a)
    else:
        mo.append(a)

if len(m4) >= len(mo):
    print('Yes')
elif len(m2) == 0 and len(m4) >= len(mo) - 1:
    print('Yes')
else:        
    print('No')

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]
odd, two, four = 0, 0, 0
for a in A:
    if a % 4 == 0:
        four += 1
    elif a % 2 == 0:
        two += 1
    else:
        odd += 1

if (four + odd) % 2 == 0:
    if four >= odd:
        print("Yes")
    else:
        print("No")
else:
    if four > odd:
        print("Yes")
    elif four == (four + odd)//2 and two == 0:
        print("Yes")
    else:
        print("No")

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
cnt_odd = 0
cnt_4 = 0

for ai in a:
    if ai % 2 == 1:
        cnt_odd += 1
    if ai % 4 == 0:
        cnt_4 += 1
        
if cnt_4 >= cnt_odd:
    ans = "Yes"
else: 
    ans = "No"

if N == cnt_4 + cnt_odd and cnt_4 >= cnt_odd-1:
    ans = "Yes"
    
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
p = 0
q = 0
for x in a:
  if x%2 == 1:
    p += 1
  elif x%4 == 0:
    q += 1
if (p == q+1 and  p+q == n) or  p <= q:
  print("Yes")
else:
  print("No")

Solution (Python):

from sys import stdin

n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]
bai_2 = 0
bai_4 = 0
bai_1 = 0

for i in range(n):
    if a[i] % 4 == 0:
        bai_4 += 1
    elif a[i] % 2 == 0:
        bai_2 += 1
    else:
        bai_1 += 1
        
if bai_2 == 0:
    if bai_4 >= bai_1 - 1:
        print("Yes")
    else:
        print("No")
else:
    if bai_4 >= bai_1:
        print("Yes")
    else:
        print("No")

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]
n2 = 0; n4 = 0
for ai in a:
    if ai%4 == 0:
        n4 += 1
    elif ai%2 == 0:
        n2 += 1

ans = "No"
if n4*2+1 >= N or n4*2 >= N-n2 or n2 == N:
    ans = "Yes"

print(ans)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

bai_4 = 0
bai_2 = 0

for a in A:
    if a%4 == 0:
        bai_4 += 1
    elif a%2 == 0:
        bai_2 += 1

ch = N - bai_4 * 2 - bai_2

if ch <= 0:
    print('Yes')
elif ch == 1 and N%2 == 1:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
c4=0
c2=0

for i in range(n):
    if a[i]%4==0:
        c4+=1
for i in range(n):
    if a[i]%2==0:
        c2+=1

if n<=(2*c4 + max(1,c2-c4)):
    print('Yes')
else:
    print('No')

Solution (Python):


INF = float('inf')


def inpl(): return list(map(int, input().split()))


N = int(input())
A = inpl()

mod2 = 0
mod4 = 0
for a in A:
    if a % 2 == 0:
        mod2 += 1
    if a % 4 == 0:
        mod4 += 1

if mod4 >= N // 2:
    print('Yes')
elif mod2 - mod4 >= 2 and N - mod2 <= mod4:
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
A0=0
A4=0
for i in range(N):
    if A[i]%2==1:
        A0+=1
    elif A[i]%4==0:
        A4+=1
if A4>=A0:
    print("Yes")
elif A4+1==A0 and A4+A0==N:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
listA=  list(map(int, input().split()))

index=0
countTwo =0
countFour=0
while index < len(listA):
    if listA[index]%4 ==0:
        countFour+=1
    elif listA[index]%2 ==0:
        countTwo+=1
    else:
        pass
    index+=1

if countFour + countTwo//2 > n//2-1:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

b = []
for i in range(n):
    count = 0
    while a[i] % 2 == 0:
        a[i] = a[i] // 2
        count += 1
    b.append(count)

n0 = 0
n2 = 0
n4 = 0
for i in range(n):
    if b[i] == 0:
        n0 += 1
    elif b[i] == 1:
        n2 += 1
    else:
        n4 += 1

if n2 > 0:
    if n4 >= n0:
        print("Yes")
    else:
        print("No")
else:
    if n4 >= n0 - 1:
        print("Yes")
    else:
        print("No")

Solution (Python):
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return 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")