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

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
 




 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    a = inputList()
    
    tmp = 0
    gu = 0
    for i, val in enumerate(a):
        if val % 4 == 0:
            tmp += 1
            continue
        if val % 2 == 0:
            gu += 1
            
    if tmp >= N // 2:
        print("Yes")
        sys.exit()
    
    aaa = (N // 2) - tmp
    gugu = gu // 2
    
    if aaa <= gugu:
        print("Yes")
        sys.exit()
        
    print("No")
    
    
if __name__ == "__main__":
	main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
c1=c2=0
for i in range(n):
    if a[i]%2==0:c1+=1
    if a[i]%4==0:c2+=1
c1-=c2
if c2*2>=n-1:print('Yes')
else: print('YNeos'[2*c2+c1<n::2])

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

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

odd_cnt = 0
four_times_cnt = 0
two_times_cnt = 0
for a in A:
    if a % 2 == 1:
        odd_cnt += 1
    elif a % 4 == 0:
        four_times_cnt += 1
    elif a % 2 == 0:
        two_times_cnt += 1

if two_times_cnt >= 1:
    if odd_cnt <= four_times_cnt:
        print('Yes')
    else:
        print('No')
else:
    if odd_cnt <= four_times_cnt + 1:
        print('Yes')
    else:
        print('No')

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

a4 = 0
a2 = 0
a0 = 0
for a in A:
    if a % 4 == 0:
        a4 += 1
    elif a % 4 == 2:
        a2 += 1
    else:
        a0 += 1

if a2 == 0:
    if a4 >= a0-1:
        print('Yes')
    else:
        print('No')
elif a0 == 0:
    print('Yes')
else:
    if a4 >= a0:
        print('Yes')
    else:
        print('No')

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
n4=sum([i%4==0 for i in l])
n2=sum([i%2==0 for i in l])-n4
if n4>=max(n//2,1):
    print("Yes")
else:
    if (n//2)*2-n4*2<=n2:
        print("Yes")
    else:print("No")

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007


def A():
    n, m = LI()
    print((n-1)*(m-1))
    return


def B():
    s = S()
    print(s[0]+str(len(s)-2)+s[-1])
    return


def C():
    II()
    a = LI()
    a1 = 0
    a2 = 0
    a3 = 0
    for ai in a:
        if not ai % 4:
            a3 += 1
            continue
        if not ai % 2:
            a2 += 1
            continue
        a1 += 1
    if a2:
        print(["No", "Yes"][a3 >= a1])
        return
    print(["No", "Yes"][a3 >= a1 - 1])
    return
    """
    n, m = LI()
    x = -1
    y = -1
    z = -1
    for i in range(n + 1):
        a = m - 9000 * i - 1000 * n
        if a % 4000 == 0 and a >= 0 and n - i - a / 4000 >= 0:
            y = a / 4000
            z = n - i - y
            x = i
            break
    print(int(x),int(y),int(z))
    """

def D():
    return


if __name__ == '__main__':
    C()

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]
n2,n4,odd = 0, 0, 0

for i in a:
  if i % 2 == 1:
    odd += 1
  elif i % 4 == 0:
    n4 += 1
  else:
    n2 += 1
if n2 == 0 and n4 >= odd-1:
  print("Yes")
elif n2 > 0 and n4 >= odd:
  print("Yes")
else:
  print("No")

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

c = 0  
f1 = False  
for aa in a:
    if aa % 4 == 0:
        c += 1
    elif aa % 2 == 0:
        f1 = True
    elif aa % 2 == 1:
        c -= 1

x = 0 if f1 else -1
print('Yes' if c >= x else 'No')

Solution (Python):
import sys
input=sys.stdin.readline
n=int(input())
a_list=list(map(int,input().split()))
a_13=0
a_2=0
a_0=0
for i in a_list:
    m=i%4
    if m==0:
        a_0+=1
    elif m==2:
        a_2+=1
    else:
        a_13+=1
if a_0>=a_13:
    print('Yes') 
else:
    if a_0==a_13-1 and a_0+a_13==n:
        print('Yes')
    else:
        print('No')

Solution (Python):
import sys


fin = sys.stdin.readline
N = int(fin())
a_list = [int(elem) for elem in fin().split()]
num_dividable_by_4 = 0
num_dividable_by_2 = 0
for a in a_list:
    if a % 4 == 0:
        num_dividable_by_4 += 1
    elif a % 2 == 0:
        num_dividable_by_2 += 1
num_odds = N - num_dividable_by_2 - num_dividable_by_4
if not num_dividable_by_2:
    is_objective_viable = num_dividable_by_4 >= num_odds - 1
else:
    is_objective_viable = num_dividable_by_4 >= num_odds
print("Yes" if is_objective_viable else "No")

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

x = 0  
y = 0  
z = 0  
for num in a:
	if num % 2 == 1:
		x += 1
	elif num % 4 == 0:
		z += 1
	else:
		y += 1

if y:
	x += 1


if (x+z) % 2 == 1:
	if z >= x-1:
		print("Yes")
	else:
		print("No")

else:
	if z >= x:
		print("Yes")
	else:
		print("No")

Solution (Python):
N = int(input())
*A, = map(int,input().split())
c = [0]*3
for a in A:
    if a%2:c[0]+=1
    elif a%4:c[1]+=1
    else:c[2]+=1
if c[1]==1: c[0:2] = [c[0]+1,0]
if c[1]==0:
    ans = c[2]>0 and c[0]<=c[2]+1
else:
    ans = c[0]<=c[2]
print("Yes" if ans else "No")

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

if Devide_by_Four >= len(a)//2:
    print("Yes")
elif Devide_by_Four >= Odd:
    print("Yes")
else:
    print("No")

Solution (Python):



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

total = 0
for i in a:
    if i % 2 == 0 and i % 4 != 0:
        total += 1/2
    elif i % 4 == 0:
        total += 1
if total >= n//2:
    print('Yes')
else:
    print('No')

Solution (Python):
def f(n, A):
    odd = 0
    four = 0

    for a in A:
        if a % 2 == 1:
            odd += 1
        if a % 4 == 0:
            four += 1

    if odd == 0:
        return True

    if n % 2 == 0:
        return odd - four <= 0
    else:
        return odd - four <= 1


n = int(input())
A = list(map(int, input().split()))
print("Yes" if f(n, A) else "No")

Solution (Python):
def main():
    N = int(input())
    ni = 0
    yon = 0
    ans = "No"
    for a in input().split():
        a = int(a)
        if a % 4 == 0:
            yon += 1
        elif a % 2 == 0:
            ni += 1

    if int(N / 2) <= yon:
        ans = "Yes"
    elif (N-2*yon) <= ni:
        ans = "Yes"

    print(ans)


if __name__ == "__main__":
    main()

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

four_count = 0
two_count = 0
for i in a:
    if i % 4 == 0:
        four_count += 1
    elif i % 2 == 0:
        two_count += 1

if (N // 2) > four_count:
    tmp = (N // 2) - four_count
    if two_count >= tmp * 2:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
else:
    print("Yes")

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

four = len(a)-len(list(filter(lambda x:x%4, a)))
two = len(a)-len(list(filter(lambda x:x%2, a))) - four
no = len(a) - four - two

if two: print("YNeos"[no>four::2])
else: print("YNeos"[no-four>1::2])

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

a1 = 0
a2 = 0
a4 = 0

for i in a:
    if i % 4 == 0:
        a4 += 1
    elif i % 2 == 0:
        a2 += 1
    else:
        a1 += 1

if a2 == 0 and a4 >= a1 - 1:
    print("Yes")
elif a2 > 0 and a4 >= a1:
    print("Yes")
else:
    print("No")

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

four = len(list(filter(lambda x: x % 4 == 0, A)))
two = len(list(filter(lambda x: x % 2 == 0 and x % 4 != 0, A)))
odd = N - two - four

if odd == 0 and two % 2 == 0:
    print('Yes')
elif four > 0 and odd + two % 2 <= four + 1:
    print('Yes')
else:
    print('No')

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

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

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
if two>0:
    ans=four*2+two
else:
    ans=four*2+1

if ans>=n:
    print("Yes")
else:
    print("No")

Solution (Python):

N = int(input())

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

Fo = 0
Tw = 0
Od = 0

for i in a:

    if i % 4 == 0:
        Fo += 1

    elif i % 2 == 0:
        Tw = 1

    else:
        Od += 1

if Tw + Od <= Fo + 1:

    print ("Yes")

else:
    print ("No")

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
odd = by2 = by4 = 0
for c in a:
    if c % 4 == 0:by4 += 1
    elif c % 2 == 0:by2 += 1
    else:odd += 1

if N == 2:
    if by4>=1:print('Yes')
    elif by2 == 2:print('Yes')
    else:print('No')
elif N == 3:
    if odd == 3:print('No')
    elif odd==2:
        if by4==1:print('Yes')
        else:print('No')
    elif odd==1:
        if by4>=1:print('Yes')
        else:print('No')
    else:print('Yes')
else:
    if by2 > 0:
        if by4-odd>=0:print('Yes')
        else:print('No')
    else:
        if by4-odd>=-1:print('Yes')
        else:print('No')

Solution (Python):

def main():
    n = int(input())
    A = tuple(map(int, input().rstrip().split()))
    f, t, m = 0, 0, 0  
    for i in A:
        if i % 4 == 0:
            f += 1
        elif i % 2 == 0:
            t += 1
        else:
            m += 1
    m += t % 2
    print("Yes" if m - f <= 1 else "No")


if __name__ == "__main__":
    main()

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

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

Solution (Python):
N = int(input())
*A, = map(int, input().split())
counter = {0: 0, 2: 0, 4: 0}
for a in A:
    _, r = divmod(a, 4)
    if r == 0: counter[4] += 1
    elif r == 2: counter[2] += 1
    else: counter[0] += 1
print('Yes' if counter[0] <= counter[4] or (counter[0] == counter[4] + 1 and counter[2] == 0) else 'No')

Solution (Python):
def main():
    _ = int(input())
    A = list(map(int, input().split()))
    b1 = 0
    b2 = 0
    b4 = 0
    for a in A:
        if a % 2 == 0:
            if a % 4 == 0:
                b4 += 1
            else:
                b2 += 1
        else:
            b1 += 1
    if b2 > 0:
        if b4 >= b1:
            print('Yes')
            return
    else:
        if b4 + 1 >= b1:
            print('Yes')
            return
    print('No')


main()

Solution (Python):
n = int(input())
dat_a = map(int, input().split())
dat_a = list(dat_a)
d1 = d2 = d4 = 0
for i in range(n):
    if dat_a[i] % 4 == 0:
        d4 += 1
    elif dat_a[i] % 2 == 0:
        d2 += 1
    else:
        d1 += 1
if d2 == 0:
    if d4 >= d1 - 1:
        print("Yes")
    else:
        print("No")
else:
    if d4 >= d1:
        print("Yes")
    else:
        print("No")

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
Odd,Four=0,0
for a in A:
    if a%2==1:Odd+=1
    elif a%4==0:Four+=1
if Odd+Four==N and Odd-Four==1:print("Yes")
elif Odd<=Four:print("Yes")
else:print("No")

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

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

count = 0
scount = 0
sscount = 0
for i in range(N):
    if A[i] % 4 == 0:
        count += 1
    elif A[i] == 2:
        scount += 1
    elif A[i] % 2 == 0:
        scount += 1


subcount = 0
subcount = scount // 2



if N % 2 == 0:
    _l = int(N / 2)
    if _l <= subcount + count:
        print('Yes')
        exit()

else:
    _l = N // 2
    if _l <= subcount + count:
        print('Yes')
        exit()


print('No')

Solution (Python):
N=int(input())
d4=0
d2=0
for a in input().split():
    if int(a)%4==0:
        d4+=1
    elif int(a)%2==0:
        d2+=1


if N%2==1 and d2==0 and (N-1)//2<=d4:
    print('Yes')
elif 2*d4+d2>=N:
    print('Yes')
else:
    print('No')

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

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


four = 0
two = 0
els = 0

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

if two == 0:
    if four + 1 >= els:
        print('Yes')
    else:
        print('No')
else:
    if four >= els:
        print('Yes')
    else:
        print('No')

Solution (Python):

def main():
    num = int(input())
    data = list(map(int, input().split()))

    saikyo, hutu, dame = 0, 0, 0
    for ele in data:
        if ele % 4 == 0:
            saikyo += 1
        elif ele % 2 == 0:
            hutu += 1
        else:
            dame += 1

    flg = 1
    if saikyo + 1 < dame:
        flg = 0
    if dame == saikyo + 1 and hutu > 0:
        flg = 0

    if flg:
        print('Yes')
    else:
        print('No')




if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
W,Q = 0,0 
for i in a:
    if i%4 == 0:
        Q += 1
    elif i%2 == 0:
        W += 1
if Q >= N//2 or Q >= (N-W)/2:
    print("Yes")
else:
    print("No")

Solution (Python):
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()
A = nl()

odds = 0
devens = 0
for a in A:
    if a % 2 == 1:
        odds += 1
    elif (a // 2) % 2 == 0:
        devens += 1

if devens >= odds:
    print('Yes')
elif devens == odds - 1 and devens + odds == N:
    print('Yes')
else:
    print('No')

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

if two == 0:
	if four >= odd - 1:
		print("Yes")
	else:
		print("No")
else:
	if four >= odd:
		print("Yes")
	else:
		print("No")

Solution (Python):

import sys


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

cnt = [0] * N
for i, ai in enumerate(a):
    for cnti in range(128):
        if ai % (2 << cnti) > 0: break
    cnt[i] = cnti

cnt4 = 0
cnt2 = 0
cnt1 = 0
for cnti in cnt:
    if cnti < 1: cnt1 += 1
    elif cnti > 1: cnt4 += 1
    else: cnt2 += 1


if N < 2:
    if cnt[0] >= 2: print('Yes')
    else: print('No')
elif cnt2 == 0:
    if cnt4 == 0: print('No')
    elif cnt1 > cnt4 + 1: print('No')
    else: print('Yes')
else:
    if cnt1 > cnt4: print('No')
    else: print('Yes')

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

cnt1 = 0
cnt2 = 0
cnt4 = 0

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

if cnt2==0:
    if cnt4+1>=cnt1:
        print("Yes")
    else:
        print("No")
else:
    if cnt4>=cnt1:
        print("Yes")
    else:
        print("No")

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

odd_count = 0
four_times_count = 0
two_times_count = 0
for i in a:
  if i % 4 == 0:
    four_times_count += 1 
  elif i % 2 != 0:
    odd_count += 1
  elif i % 2 == 0 and i % 4 != 0:
    two_times_count += 1

if odd_count == 0 or odd_count == four_times_count or (two_times_count == 0 and odd_count - four_times_count == 1):
  print('Yes')
else: 
  print('No')

Solution (Python):

import sys

YES = "Yes"  
NO = "No"  

def solve(N: int, a: "List[int]"):
    count = [0] * 3
    for v in a:
        if v % 4 == 0:
            count[2] += 1
        elif v % 2 == 0:
            count[1] += 1
        else:
            count[0] += 1
    if count[0] == count[2] + 1 and count[1] == 0:
        ret = YES
    elif count[0] > count[2]:
        ret = NO
    else:
        ret = YES
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    a = [ int(next(tokens)) for _ in range(N) ]  
    solve(N, a)

if __name__ == '__main__':
    main()

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

count4 = 0
count2 = 0
count0 = 0
for i in a:
    if i % 2 == 0:
        if i % 4 == 0:
            count4 += 1
        else:
            count2 += 1
    else:
        count0 += 1

if count0 <= count4:
    print ('Yes')
elif count0 == count4 + 1 and count2 == 0:
    print ('Yes')
else:
    print ('No')

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

Solution (Python):
n=int(input())
a=[int(_)%4 for _ in input().split()]
e=a.count(2);f=a.count(0)
print('Yes' if (n-e-1)//2<f or n//2==f else 'No')

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


N = int(input())
As = list(mi())

cnt4 = 0
cnt2 = 0
cnt1 = 0

for a in As:
  if a % 4 == 0:
    cnt4 += 1
  elif a % 2 == 0:
    cnt2 += 1
  else:
    cnt1 += 1

possiblelength = 0
if cnt1 ==0:
  print('Yes')
  exit()
if cnt4 >= 1 and cnt2 >= 1:
  possiblelength = (cnt4 * 2) + cnt2
elif cnt4 >= 1 and cnt2 == 0:
  possiblelength = cnt4 * 2 + 1
elif cnt4 == 0 and cnt2 >= 1:
  possiblelength = cnt2 -1
else:
  possiblelength = 0

if possiblelength >= N:
  print('Yes')
else: print('No')

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



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

Solution (Python):
N = int(input())
A = [int(s) for s in input().split()]

def main():

    a = A
    len_all = len(a)
    len_2 = len(list(filter(lambda n: n % 2 == 0 and n % 4 != 0, a)))
    len_4 = len(list(filter(lambda n: n % 4 == 0, a)))
    len_others = len(list(filter(lambda n: n % 2 != 0, a)))

    if len_all == len_2:
        ans = 'Yes'
    else:
        ans = 'Yes' if len_4 + 1 >= min(1, len_2) + len_others else 'No'
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
c2=0
c4=0
for a in map(int,input().split()):
	if a%4==0:c4+=1
	elif a%2==0:c2+=1
if c2>1:n-=c2-1
print('Yes' if c4>=n//2 else 'No')

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ct1=0;ct2=0;ct4=0
for i in range(n):
  if a[i]%4==0:ct4+=1
  elif a[i]%2==0:ct2+=1
  else:ct1+=1
if ct2!=0:ct1+=1
if ct1>ct4+1:print('No')
else:print('Yes')

Solution (Python):
import itertools
import math
N = int(input())
As =list(map(int,input().split(" ")))
odds = 0
two = 0
four = 0
nums = []
for a in As:
    if a % 2 == 1:
        odds += 1
    elif a % 4 == 0:
        four += 1
    else:
        two += 1
if odds > 0:
    nums.append(1)
    odds -= 1
elif two > 0:
    nums.append(2)
    two -=1
else:
    nums.append(4)
    four-=1
ans = "Yes"

if N==2:
    if As[0] * As[1]%4 !=0:
       ans = "No"
else:
    for i in range(1,N):
        if nums[i-1] == 1:
            if four > 0:
                nums.append(4)
                four -=1
            else:
                ans = "No"
                break
        elif nums[i - 1] == 2:
            if two> 0:
                nums.append(2)
                two -= 1
            elif four > 0:
                nums.append(4)
                four -=1
            else:
                ans = "No"
                break
        elif nums[i - 1] == 4:
            if odds> 0:
                nums.append(1)
                odds -= 1
            elif two> 0:
                nums.append(2)
                two -= 1
            elif four > 0:
                nums.append(4)
                four -=1

print(ans)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  a=b=0
  for x in l:
    if x%4==0:
      b+=1
    elif x%2==0:
      a+=1

  if a==0 and b*2+1>=n:
    return 'Yes'
  elif a+b*2>=n:
    return 'Yes'
  return 'No'

print(main())

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

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

multi_four = []
multi_two  = []

for i in l:
    if i % 4 == 0:
        multi_four.append(i)
    
    elif i % 2 == 0 and i % 4 != 0:
        multi_two.append(i)

if len(multi_two) == 0:
    if n - (len(multi_two) + len(multi_four)) <= len(multi_four) + 1:
        print('Yes')
    
    else:
        print('No')

else:
    if n - (len(multi_two) + len(multi_four)) <= len(multi_four):
        print('Yes')
    
    else:
        print('No')

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
odd = 0
four = 0
for i in range(0, N):
	if A[i] % 4 == 0: four += 1
	if A[i] % 2 != 0: odd += 1
if odd <= four+N%2: print('Yes')
else: print('No')

Solution (Python):
N = int(input())
As = list(map(int, input().split()))
odd = 0
fo = 0
for a in As:
    if a%4 == 0:
        fo += 1
    elif a%2 == 1:
        odd += 1
if odd + fo == N:
    if odd-fo <= 1:
        print('Yes')
    else:
        print('No')
else:
    if odd-fo <= 0:
        print('Yes')
    else:
        print('No')

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

four_gcd = 0
two_gcd = 0
odd = 0

for a in A:
	if a%4 == 0:
		four_gcd += 1
	elif a%2 == 0:
		two_gcd += 1
	else:
		odd += 1


if two_gcd > 0:
	odd += 1

if odd > four_gcd+1:
	print('No')
else:
	print('Yes')

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

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

odd = sum(a % 2 for a in arr)
four = sum(a % 4 == 0 for a in arr)
even = n - odd - four

if even:
    print("Yes" if four >= odd else "No")
else:
    print("Yes" if four >= odd - 1 else "No")

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]
n1 = 0
n2 = 0
n4 = 0

for a in A:
  if a&1:
    n1 += 1
  elif a%4==0:
    n4 += 1
  else:
    n2 += 1

 
bl = True

if n1 > n4:
  
  if not(n1 == n4 + 1 and n2 == 0):
    bl = False

answer = 'Yes' if bl else 'No'
print(answer)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
d2=0
d4=0
dn=0
for i in a:
    if i%4==0:
        d4+=1
    elif i%2==0:
        d2+=1
    else:
        dn+=1
print('Yes' if d4>=dn or (dn-d4==1 and d2==0) else 'No')

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

x = y = z = 0
for val in a:
    if val % 4 == 0:
        x += 1
    elif val % 2 == 0:
        y += 1
    else:
        z += 1

if z == 0:
    print('Yes')
elif x == 0:
    print('No')
elif y == 0 and x + 1 >= z:
    print('Yes')
elif x >= z:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
num = [ int(v) for v in input().split() ]
a, b, c = 0, 0, 0
for i in num:
	if i % 2 != 0:
		a += 1
	elif i % 4 != 0:
		b += 1
	else:
		c += 1
if b == 0:
	if c >= a - 1:
		print("Yes")
	else:
		print("No")
else:
	if c >= a:
		print("Yes")
	else:
		print("No")

Solution (Python):
_, *a = map(int, open(0).read().split())
ans = [0] * 4
for v in a:
    ans[v % 4] += 1

if (ans[0] >= ans[1] + ans[3]) or (ans[0] == ans[1] + ans[3] - 1 and ans[2] == 0):
    print('Yes')
else:
    print('No')

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
one=n-two-four
if one>=four+2 or\
one==four+1 and two>=1:
  print("No")
else:       
  print("Yes")

Solution (Python):
from collections import Counter

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

n_multi4 = 0
n_multi2 = 0
for i in range(N):
  if A[i] % 4 == 0:
    n_multi4 += 1
  elif A[i] % 2 == 0:
    n_multi2 += 1

n_odd = N - (n_multi4 + n_multi2)

if n_multi4 >= n_odd:
  print('Yes')
elif n_multi4 +1 == n_odd and n_multi2 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
x4, x2, x = 0, 0, 0
for a in A:
    if a % 4 == 0:
        x4 += 1
    else:
        if a % 2 == 0:
            x2 = 1
        else:
            x += 1
print('Yes' if x2 + x - 1 <= x4 else 'No')

Solution (Python):
n=int(input())
arr=list(map(int,input().split()))
cnt1=0
cnt2=0
for i in range(n):
  if arr[i]%4==0:
    cnt1+=1
  elif arr[i]%2==0:
    cnt2+=1
if cnt1*2>=n-1:
  print('Yes')
else:
  n-=(cnt1*2)
  if cnt2>=n:
    print('Yes')
  else:
    print('No')

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

for i in a:
    if i%4 == 0:
        tetra += 1
    elif i%4 == 2:
        di += 1

if tetra*2+di >= n or tetra*2+1 >= n:
    print("Yes")
else:
    print("No")

Solution (Python):


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

    
    
    
    
    
    
    num4 = 0
    num2 = 0
    for a in A:
        if a%4 == 0:
            num4 += 1
        elif a%2 == 0:
            num2 += 1
    
    if (num4*2+1) >= N:
        print("Yes")
    elif (num4*2)+num2 >= N:
        print("Yes")
    else:
        print("No")



if __name__ == "__main__":
    solve()

Solution (Python):
N = int(input())
lst_a = list(map(int, input().split()))
cnt_mod4 = 0
cnt_odd = 0
cnt_mod2 = 0
ans = "No"


for a in lst_a:
    if a % 4 == 0:
        cnt_mod4 += 1
    elif a % 2 != 0:
        cnt_odd += 1
    else:
        cnt_mod2 += 1


if cnt_mod2 != 0:
    cnt_odd += 1


if cnt_odd <= cnt_mod4 + 1:
    ans = "Yes"


print(ans)

Solution (Python):
N = int(input())
lst_a = list(map(int, input().split()))
cnt_4times = 0
cnt_odd = 0
cnt_even = 0
ans = "No"


for a in lst_a:
    if a % 4 == 0:
        cnt_4times += 1
    elif a % 2 != 0:
        cnt_odd += 1
    else:
        cnt_even += 1


if cnt_even != 0:
    cnt_odd += 1


if cnt_odd <= cnt_4times + 1:
    ans = "Yes"


print(ans)

Solution (Python):


import math




N = int(input())
An = list(map(int, input().split()))
cnt = [0,0,0]
for a in An:
  if a%4 == 0:
    cnt[2] += 1
  elif a%2 == 0:
    cnt[1] += 1
  else:
    cnt[0] += 1

if cnt[2] >= cnt[0]:
  print('Yes')
elif cnt[0]-cnt[2]==1 and cnt[1]==0:
  print('Yes')
else:
  print('No')

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

Solution (Python):
N=int(input())
c={1:0,2:0,4:0}
for a in map(int,input().split()):
	if a % 2 == 0:
		if (a // 2) % 2 == 0:
			c[4] += 1
		else:
			c[2] += 1
	else:
		c[1] += 1

if c[2] > 0:
	c[1] += 1

print("No" if c[1] >= c[4] + 2 else "Yes")

Solution (Python):

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

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

Solution (Python):

N = int(input())
ai = list(map(int, input().split()))
mult_4 = 0
odd = 0
mult_2 = 0
for a in ai:
    if a%4 == 0:
        mult_4 += 1
    elif a%2 == 1:
        odd += 1
    else:
        mult_2 += 1

if mult_2 != 0 and mult_4 >= odd:
    print("Yes")
elif mult_2 == 0 and mult_4+1 >= odd:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
cnt = [0]*3
for a in A:
    b = a%4
    if b==0:
        cnt[2] += 1
    elif b==2:
        cnt[1] += 1
    else:
        cnt[0] += 1
if (N-2*cnt[2]-1) <= max(0,cnt[1]-1):
    print("Yes")
else:
    print("No")