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

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

div1=0
div2=0
div4=0
lenS=len(S)

for i in range(N):
    if S[i]%4==0:
        div4+=1
    elif S[i]%2==0:
        div2+=1
    else:
        div1+=1

if lenS%2==0:

    if div4*2+div2>=lenS:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
else:
    
    if (div4*2+1)>=lenS:
        print("Yes")
        exit()
    elif div4*2+div2>=lenS:
        print("Yes")
        exit()
    else:
        print("No")
        exit()

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

ok = four == no or (four+two) == N
ok = ok or ((four+no) == N and abs(four-no) <= 1)
if ok:
    print("Yes")
else:
    print("No")

Solution (Python):
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
def div2(t):
    count = 0
    while t % 2 == 0:
        count += 1
        t //= 2
    return count
b = np.array([div2(i) for i in a])
odd = len(b[b == 0])
four = len(b[b >= 2])
if odd == 0:
    print('Yes')
elif odd == n:
    print('No')
elif odd <= four or ((odd == four + 1) and (odd + four) == n):
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
a_list = list(map(int, input().split()))
fours = []
twos = []
others = []

for a in a_list:
    if a % 4 == 0:
        fours.append(a)
    elif a % 2 == 0:
        twos.append(a)
    else:
        others.append(a)

if len(twos) > 0:
    if len(fours) - len(others) < 0:
        print('No')
    else:
        print('Yes')

else:
    if len(fours) - len(others) < -1:
        print('No')
    else:
        print("Yes")

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

N_list = [0] * 3

for i in range(N):
    num = A_s[i]
    
    if (num % 4 == 0):
        N_list[2] += 1
    elif (num % 2 == 0):
        N_list[1] += 1
    else:
        N_list[0] += 1

if (N_list[2] >= N_list[0]):
    ans = 'Yes'
elif (N_list[1] == 0 and N_list[2] + 1 == N_list[0]):
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SMI(): return input().split()
def SLI(): return list(input())

def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')








def solve():
    N = II()
    A = LI()

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

    j = four + two // 2
    
    if N // 2 <= j:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    solve()

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

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

cnt_1 = 0
cnt_2 = 0
for i in a:
    if i%4 == 0:
        cnt_1 += 1
    elif i%2 == 0:
        cnt_2 += 1
    
cnt_2 //=2

total = cnt_1 + cnt_2

if len(a)//2 <= total:
    print("Yes")
else:
    print("No")

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

c1 = 0
c2 = 0
c4 = 0

for ai in a:
  if ai%2 == 0:
    if ai%4 == 0:
      c4 += 1
    else:
      c2 += 1
  else:
    c1 += 1

if c2 == 0:
  if c4 >= c1-1:
    print('Yes')
  else:
    print('No')
else:
  if c4 >= c1:
    print('Yes')
  else:
    print('No')

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7

		
N = INT()
a = LIST()

odd = 0
even_2 = 0
even_4 = 0
for x in a:
	if x%4 == 0:
		even_4 += 1
	elif x%2 == 0:
		even_2 += 1
	else:
		odd += 1

if even_4+1 == odd and even_2 == 0:
	print("Yes")
elif odd > even_4:
	print("No")
else:
	print("Yes")

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

Solution (Python):
N,*a = map(int, open(0).read().split())
b = [x for x in a if x % 4 == 0]
c = [x for x in a if x % 2 == 0]
d = [x for x in a if x % 2 == 1]
if len(b) >= len(a) // 2:
    print('Yes')
elif len(d) <= len(b):
    print('Yes')
elif len(c) == len(a):
    print('Yes')
else:
    print('No')

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

count_4 = len([a for a in A if a % 4 == 0])
count_2 = len([a for a in A if a % 2 == 0]) - count_4
others = n - (count_4 + count_2)

ans = ""
if count_2 == 0:
    ans = "Yes" if others <= count_4 + 1 else "No"
else:
    ans = "Yes" if others <= count_4 else "No"
print(ans)

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

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import copy
from itertools import permutations
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

from itertools import permutations
from math import factorial, hypot





N = getN()
A = getList()

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

if cnt4 * 2 + 1 >= N:
    print('Yes')
else:
    left = N - cnt4 * 2
    if cnt2 >= left:
        print('Yes')
    else:
        print('No')

Solution (Python):
def main():
    n = int(input())
    A = list(map(int, input().split()))
    n2 = sum([a % 2 == 0 for a in A])
    n4 = sum([a % 4 == 0 for a in A])
    nodd = n - n2
    n2 -= n4
    if nodd == n4 + 1:
        if n2 == 0:
            print('Yes')
        else:
            print('No')
    elif nodd <= n4:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
cou1=0
cou2=0
cou4=0
for i in range(n):
    if lis[i]%4==0:
        cou4+=1
    elif lis[i]%2==0:
        cou2+=1
    else:
        cou1+=1
if cou4>=cou1:
    print("Yes")
elif cou4+1==cou1 and cou2==0:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
two=0
four=0
odd=0

for i in range(N):
    cnt=0
    if a[i]%2==0:
        cnt+=1
    if a[i]%4==0:
        cnt+=1
    
    if cnt==0:
        odd+=1
    elif cnt==1:
        two+=1
    else:
        four+=1

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

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

print('Yes' if cnt_4*2+1>=n or (cnt_4*2+cnt_2>=n) else 'No')

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

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

for i in a:
  if i%4 == 0:
    count4 += 1
  if i%2 == 0:
    c += 1
only2 = c-count4
if only2 == 0 and count4 + 1 == len(a)-c:
  print('Yes')
elif count4 < len(a)-c:
  print('No')
else:
  print('Yes')

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

n4 = len(list(filter(lambda x: x % 4 == 0, n)))
no = len(list(filter(lambda x: x % 2 == 1, n)))
if n4 + no < N:
    no += 1

if no <= n4 + 1:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
kisu = 0
gusu = 0
num_4 = 0

for i in range(N):
    if a[i] % 2 == 1:
        kisu += 1
    elif a[i] % 4 == 0:
        num_4 += 1
    else:
        gusu += 1
if gusu != 0:
    kisu += 1

print('Yes' if kisu <= num_4+1 else 'No')

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

foud = 0
twod = 0

for i in range(n):
    if al[i] % 4 ==0:
        foud += 1
    elif al[i] % 2 ==0:
        twod += 1
        
if (foud*2+1)+max(0,(twod-1)) >=n:
    print("Yes")
else:
    print("No")

Solution (Python):
import math

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

mul2 = 0
mul4 = 0
for i in s:
    if i%4 == 0:
        mul4 += 1
    elif i%2 == 0:
        mul2 += 1

if mul4 >= math.floor(n/2):
    print("Yes")
elif mul2 == n:
    print("Yes")
elif n-mul2-mul4-1+mul2%2 <= mul4:
    print("Yes")
else:
    print("No")

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split(' ')))
    c_4, c_2, c_0 = 0, 0, 0
    for a in A:
        if a % 4 == 0:
            c_4 += 1
        elif a % 2 == 0:
            c_2 += 1
        else:
            c_0 += 1
    if c_2 == N:
        print('Yes')
    elif 0 < c_2 < N:
        print('Yes' if c_4 > 0 and c_4 >= c_0 else 'No')
    else:
        print('Yes' if c_4 >= c_0 - 1 else 'No')


if __name__ == '__main__':
    main()

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    L = lmi()
    odd = 0
    two_multiple = 0
    four_multiple = 0
    for num in L:
        if num % 2 == 1:
            odd += 1
        elif num % 4 == 0:
            four_multiple += 1
        else:
            two_multiple += 1
    
    if odd <= four_multiple or (odd == four_multiple + 1 and two_multiple == 0):
        print('Yes')
    else:
        print('No')



if __name__ == "__main__":
    main()

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
i4=0
i2=0
i0=0
for x in a:
    if x%4==0:i4+=1
    elif x%2==0:i2+=1
    else:i0+=1
if i4>=i0:print("Yes")
elif i4+1==i0 and i2==0:print("Yes")
elif i0==0:print("yes")
else:print("No")

Solution (Python):
n = int(input())
ls = list(map(int,input().split()))
j = 0
k = 0
p = 0
for i in range(n):
    if ls[i] % 4 == 0:
        j += 1
    elif ls[i] % 2 == 0:
        k += 1
if len(ls) % 2 == 0:
    if j >= len(ls)/2:
        print("Yes")
    else:
        p = (len(ls)/2 - j) * 2
        if k >= p:
            print("Yes")
        else:
            print("No")
else:
    if j >= int(len(ls)/2):
        print("Yes")
    else:
        p = (int(len(ls)/2) - j) * 2 +1
        if k >= p:
            print("Yes")
        else:
            print("No")

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






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






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


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


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n = n//a
    count += 1
  if a**count == n:
    return count
  else:
    return count+1





N = I()
A = IL()

A = [-a&a for a in A]
d = DD(int)

for a in A:
  d[min(4,a)] += 1

if d[4]<d[1]:
  if d[4]+1==d[1] and d[2] == 0:
    YE()
  NE()
YE()

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
Q=[a for a in A if a%4==0]
W=[a for a in A if a%4==2]
if len(Q)>=n//2:
  print("Yes")
else:
  if len(W)>=n-len(Q)*2:
    print("Yes")
  else:
    print("No")

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

odd = 0
double = 0
quatro = 0

for i in a:
  if i % 2 == 1:
    odd += 1
  else:
    if i % 4 == 0:
      quatro += 1
    else:
      double += 1

if double == N:
  print("Yes")
  exit()
plus = 0
if double != 0:
  plus = 1
if plus + odd - 1 <= quatro:
  print("Yes")
else:
  print("No")

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

even = sum([1 for i in a if i % 2 == 0])
odd = sum([1 for i in a if i % 2 != 0])
multiple4 = sum([1 for i in a if i % 4 == 0])

flag = False
if even - multiple4 == 0:
    if multiple4 >= odd - 1:
        flag = True
else:
    if multiple4 >= odd:
        flag = True

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

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
memo = {1:0,2:0,4:0}

for a in A:
    if a % 4 == 0:
        memo[4] += 1
    elif a % 2 == 0:
        memo[2] += 1
    else:
        memo[1] += 1

if memo[4] >= (N//2):
    print("Yes")
elif memo[4] >= memo[1]:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
o_cnt=0
t2_cnt=0
t4_cnt=0
for i in a:
    if i%2==1:
        o_cnt += 1
    elif i%4==0:
        t4_cnt += 1
    else:
        t2_cnt += 1

if t4_cnt > 0:
    if t4_cnt >= (o_cnt-n%2):
        print('Yes')
    else:
        print('No')
else:
    if t2_cnt==n:
        print('Yes')
    else:
        print('No')

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

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

odd = 0
even = 0
four = 0

for i in A:
    if i % 4 == 0:
        four += 1
    elif i % 2 == 0:
        even += 1
    else:
        odd += 1
        
if four >= even + odd - 1:
    ans = "Yes"

if four >= odd and even > 1:
    ans = "Yes"
    
print(ans)

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

odd = 0
even = 0
four = 0

for i in A:
    if i % 4 == 0:
        four += 1
    elif i % 2 == 0:
        even += 1
    else:
        odd += 1
        
if four >= even + odd - 1:
    ans = "Yes"

if four >= odd and even > 1:
    ans = "Yes"
    
print(ans)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
count = 0
count2 = 0
for i in a:
    if i%4==0:
        count += 1
    elif i%2==0:
        count2 += 1
if count2 != 0:
    if (N-count2)%2 != 0:
        value = (N-count2)//2
    else:
        value = (N-count2)//2-1
else:
    if count >= N//2:
        value = N//2-1
    else:
        value = N//2

    value = N//2-1

if count > value:
    print('Yes')
else:
    print('No')

1414
414

Solution (Python):

"""
Created on Thu May 14 12:11:12 2020

@author: shinba
"""

n = int(input())

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

two = 0
four = 0

b = []

for i in a:
    if i % 2 == 0:
        b.append(i//2)

for i in b:
    if i % 2 == 0:
        four += 1
    else:
        two += 1

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

Solution (Python):
input()

numbers = tuple(map(int, input().split(' ')))

n_4_multiples = 0
n_2_multiples = 0
n_other = 0

for n in numbers:
    if n % 4 == 0:
        n_4_multiples += 1
    elif n % 2 == 0:
        n_2_multiples += 1
    else:
        n_other += 1

if n_2_multiples > 0:
    n_other += 1

if n_other - n_4_multiples <= 1:
    print('Yes')
else:
    print('No')

Solution (Python):
def main():
    n, *a = map(int, open(0).read().split())

    o = sum([i % 2 == 1 for i in a])
    p = sum([i % 4 == 0 for i in a])
    q = sum([i % 2 == 0 for i in a]) - p

    if p + 1 >= o and not q:
        print("Yes")
    elif p >= o and q:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):
A=int(input())
n_l= list(map(int,input().split()))
n_a = [i for i in n_l if i % 2 == 0 and i % 4 != 0]
n_b = [i for i in n_l if i % 4 == 0]
ans = len(n_b)*2+1
if len(n_a) > 0:
    ans+=len(n_a)-1
if A <= ans:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a_list = list(map(int,input().split()))
cntn = 0
cnt2 = 0
cnt4 = 0
for i in a_list:
    if i%4 == 0:
        cnt4 += 1
    elif i%2 == 0:
        cnt2 += 1
    else:
        cntn += 1
        
flag = True

if cnt4+ 1 >= cntn :
    flag = True

else:
    flag = False

if cnt2 >= 1:
    if cnt4 >= cntn :
        flag = True
    else:
        flag = False

if flag:
    print('Yes')

else:
    print('No')

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








odd=0
multiple4=0

for i in range(n):
    a = a_input[i]
    if a%2!=0:
        odd+=1
    if a%4==0:
        multiple4+=1

if odd+multiple4==n and odd-multiple4==1:print('Yes');exit()
if odd<=multiple4:print('Yes');exit()
print('No')

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
ans = 'No'
for i in range(n):
    if a[i] % 4 == 0:
        a[i] = 4
    elif a[i] % 2 == 0:
        a[i] = 2
    else:
        a[i] = 1

if a.count(2) != 0:
    if a.count(4) >= a.count(1):
        ans = 'Yes'
else:
    if a.count(4) + 1 >= a.count(1):
        ans = 'Yes'
print(ans)

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

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
ans = 'No'
for i in range(n):
    if a[i] % 4 == 0:
        a[i] = 4
    elif a[i] % 2 == 0:
        a[i] = 2
    else:
        a[i] = 1

if a.count(2) != 0:
    if a.count(4) >= a.count(1):
        ans = 'Yes'
else:
    if a.count(4) + 1 >= a.count(1):
        ans = 'Yes'
print(ans)

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

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

if x2==0:
    if x4 >= x0 - 1:
        ans = 'Yes'
    else:
        ans = 'No'
else:
    if x4 >= x0:
        ans = 'Yes'
    else:
        ans = 'No'
print(ans)

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

m=[0]*3
for i in list:
    if i%4==0:
        m[0]+=1
    elif i%2==0:
        m[1]+=1
    else:
        m[2]+=1

if(m[0]+1>=m[2]+m[1]%2):
    print("Yes")
else:
    print("No")

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

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

ans = 0

for i in A:
    if i%4 == 0:
        ans += 2
    elif i%2 == 0:
        ans += 1

if ans >= N - int(N%2==1):
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
"""
４の倍数がn//2個以上
or
全部が２の倍数
"""

n2 = 0
n4 = 0

for _a in a:
    if _a%4 == 0:
        n4 += 1
    elif _a%2 == 0:
        n2 += 1

if n4 + n2//2 >= n//2:
    print("Yes")
else:
    print("No")

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

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

Solution (Python):


N = int(input())


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

def main():
    cnt_4 = 0
    cnt_2 = 0
    cnt = 0
    for a in A:
        if a % 4 == 0:
            cnt_4 += 1
        elif a % 2 == 0:
            cnt_2 += 1
        else:
            cnt += 1
    if cnt_4 - cnt >= 0:
        print("Yes")
    elif cnt_4 - cnt == -1:
        if cnt_2 >= 1:
            print("No")
        else:
            print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

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

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

if count2<1:
  count1=len(a)-count4
else:
  count1=len(a)-count4-count2+1
if count1-count4<=1:
  print("Yes")
else:
  print("No")

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections


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

if n2 == 1:
    n2 = 0

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

Solution (Python):
def resolve():
	n = int(input())
	div4 = 0
	div2 = 0
	divn = 0
	for i in list(map(int, input().split())):
		if i % 4 == 0:
			div4 += 1
		else:
			if i % 2 == 0:
				div2 += 1
			else:
				divn += 1
	if div2:
		divn += 1
	if div4 + 1 >= divn:
		print('Yes')
	else:
		print('No')
resolve()

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

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

d4 = 0
d2 = 0
d0 = 0
for n in nums:
    if n % 4 == 0:
        d4 += 1
    elif n % 2== 0:
        d2 += 1
    else:
        d0 += 1

if d2 > 0 and d0 <= d4:
    print('Yes')
elif d2 == 0 and d0 <= d4+1:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys
N=int(input())
alist=list(map(int,input().split()))

s1=[]
s2=[]
s4=[]

for a in alist:
  if a%2==1:
    s1.append(a)
  elif a%4==0:
    s4.append(a)
  else:
    s2.append(a)


answer_list=[]
last=4
for i in range(N):
  if last==4:
    if s1:
      answer_list.append(s1.pop())
      last=1
    elif s2:
      answer_list.append(s2.pop())
      last=2
    else:
      answer_list.append(s4.pop())
      last=4
  elif last==2:
    if s2:
      answer_list.append(s2.pop())
      last=2
    elif s4:
      answer_list.append(s4.pop())
      last=4
    else:
      print("No")
      sys.exit(0)
  elif last==1:
    if s4:
      answer_list.append(s4.pop())
      last=4
    else:
      print("No")
      sys.exit(0)
      

print("Yes")

Solution (Python):
def resolve():
	n = int(input())
	a = list(map(int, input().split()))
	div4 = 0
	div2 = 0
	divn = 0
	for i in a:
		if i % 4 == 0:
			div4 += 1
		elif i % 2 == 0:
			div2 += 1
		else:
			divn += 1
	if div2 > 0:
		divn += 1
	if div4 + 1 >= divn:
		print('Yes')
	else:
		print('No')
resolve()

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
n4 = 0
n2 = 0
for a in A:
    if a%4 == 0:
        n4 += 1
    elif a%2 == 0:
        n2 += 1
if n2 == 1:
    n2 = 0
l = n4*2 + n2
if l>=n or n4*2+1 == n:
    print('Yes')
else:
    print('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()))
n4 = 0
n2 = 0
for i in range(n):
    if a[i]%4==0:
        n4+=1
    elif a[i]%2==0:
        n2+=1
if n2 ==1:
    n2 = 0
l = n4*2 + n2
if l>=n or n4*2+1 == n:
    print('Yes')
else:
    print('No')

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a4 = []
a2 = []
odd = []
for i in range(n):
    if a[i] % 4 == 0:
        a4.append(a[i])
    elif a[i] % 2 == 0:
        a2.append(a[i])
    else:
        odd.append(a[i])
if len(a) > 3:
    if len(odd) <= len(a4):
        print('Yes')
    elif len(a2) == 0:
        if n %2 == 1 and len(odd) <= len(a4)+1:
            print('Yes')
        elif n%2 == 0 and len(odd) <= len(a4):
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    if a4 or len(a2) == n:
        print('Yes')
    else:
        print('No')

Solution (Python):
def main():
    N=int(input())
    A=[int(x) for x in input().split()]
    
    cnt_4=0
    cnt_2=0
    for i in A:
        if i%4==0:
            cnt_4+=1
        elif i%2==0:
            cnt_2+=1
    
    ok=N//2
    if (cnt_4+cnt_2//2)>=ok:
        print("Yes")
    else:
        print("No")
    
if __name__=="__main__":
    main()

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

f = 0
o = 0
t = 0
for i in a:
    if i % 4 == 0:
        f += 1
    elif i % 2 == 0:
        t += 1
    else:
        o += 1
isok = True;
if t%2 == 1:
    f -= 1
if o > f+1:
    isok = False


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