CodeEff/ECCO huggingface dataset:
# Original solution
class fenwick_tree():
    def __init__(self, n:int, mod:int = 0):
        self.__mod = mod
        self.__n = n
        self.__data = [0] * self.__n

    def add(self, p:int, x:int):
        assert (0 <= p) & (p < self.__n)
        if(self.__mod == 0):
            self.__add_mod0(p,x)
        else:
            self.__add_mod(p,x)

    def __add_mod0(self, p:int, x:int):
        p+=1
        while( p<= self.__n):
            self.__data[p-1] += x
            p += p & -p

    def __add_mod(self, p:int, x:int):
        p+=1
        while( p<= self.__n):
            self.__data[p-1] += x
            self.__data[p-1] %= self.__mod
            p += p & -p

    def sum(self, l:int, r:int):
        assert (0 <= l) & (l <= r) & (r <= self.__n)
        if(self.__mod == 0):
            return self.__sum_mod0(r) - self.__sum_mod0(l)
        else:
            return self.__sum_mod(r) - self.__sum_mod(l)

    def __sum_mod0(self, r:int):
        s = 0
        while(r > 0):
            s += self.__data[r-1]
            r -= r & -r
        return s

    def __sum_mod(self, r:int):
        s = 0
        while(r > 0):
            s += self.__data[r-1]
            s %= self.__mod
            r -= r & -r
        return s

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,q = list(map(int,readline().split()))
a = list(map(int,readline().split()))
query = list(map(int,read().split()))

ft = fenwick_tree(n,mod=10**18)
ans = []

for i,ai in enumerate(a):
    ft.add(i,ai)

i = 0
for _ in range(q):
    if(query[i]==0):
        p,x = query[i+1:i+3]
        ft.add(p,x)
    else:
        l,r = query[i+1:i+3]
        ans.append(ft.sum(l,r))
    i += 3

print(('\n'.join(map(str,ans))))

# Optimized solution
class fenwick_tree():
    def __init__(self, n:int):
        self.__n = n
        self.__data = [0] * self.__n

    def add(self, p:int, x:int):
        assert (0 <= p) & (p < self.__n)
        p+=1
        while( p<= self.__n):
            self.__data[p-1] += x
            p += p & -p

    def sum(self, l:int, r:int):
        assert (0 <= l) & (l <= r) & (r <= self.__n)
        return self.__sum_mod0(r) - self.__sum_mod0(l)

    def __sum_mod0(self, r:int):
        s = 0
        while(r > 0):
            s += self.__data[r-1]
            r -= r & -r
        return s


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,q = list(map(int,readline().split()))
a = list(map(int,readline().split()))
query = list(map(int,read().split()))

ft = fenwick_tree(n)
ans = []

for i,ai in enumerate(a):
    ft.add(i,ai)

i = 0
for _ in range(q):
    if(query[i]==0):
        p,x = query[i+1:i+3]
        ft.add(p,x)
    else:
        l,r = query[i+1:i+3]
        ans.append(ft.sum(l,r))
    i += 3

print(('\n'.join(map(str,ans))))
# Original solution
n,q=list(map(int, input().split()))
*a,=list(map(int, input().split()))
bit=[0]*(2*n+1)

def add(t,x):
    while t<=n:
        bit[t]+=x
        t+=t&(-t)

def que(t):
    res=0
    while t:
        res+=bit[t]
        t-=t&(-t)
    return res

for i in range(n):
    add(i+1,a[i])


for _ in range(q):
    i,p,x=list(map(int, input().split()))
    if i:
        ans=que(x)-que(p)
        print(ans)
    else:
        add(p+1,x)


# Optimized solution
import sys
input=sys.stdin.readline
n,q=list(map(int, input().split()))
*a,=list(map(int, input().split()))
bit=[0]*(n+1)

def add(t,x):
    while t<=n:
        bit[t]+=x
        t+=t&(-t)

def que(t):
    res=0
    while t:
        res+=bit[t]
        t-=t&(-t)
    return res

for i in range(n):
    add(i+1,a[i])


for _ in range(q):
    i,p,x=list(map(int, input().split()))
    if i:
        ans=que(x)-que(p)
        print(ans)
    else:
        add(p+1,x)
# Original solution
import sys


class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def build(self, arr):
        #assert len(arr) <= n
        for i, a in enumerate(arr):
            self.add(i+1, a)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def range_sum(self, l, r):
        #assert 0 <= l <= r <= self.n
        return self.sum(r) - self.sum(l)


def main():
    n, q = list(map(int, sys.stdin.buffer.readline().split()))
    bit = Bit(n)
    bit.build(list(map(int, sys.stdin.buffer.readline().split())))
    for x in sys.stdin.buffer.readlines():
        q, p, x = list(map(int, x.split()))
        if q:
            print((bit.range_sum(p, x)))
        else:
            bit.add(p+1, x)


if __name__ == "__main__":
    main()


# Optimized solution
import sys


class Bit:
    def __init__(self, n, arr):
        self.size = n
        self.tree = [0] + arr
        for i in range(1, n+1):
            if i + (i & -i) < n + 1:
                self.tree[i + (i & -i)] += self.tree[i]

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def range_sum(self, l, r):
        return self.sum(r) - self.sum(l)


def main():
    n, q = list(map(int, sys.stdin.buffer.readline().split()))
    bit = Bit(n, list(map(int, sys.stdin.buffer.readline().split())))
    for x in sys.stdin.buffer.readlines():
        q, p, x = list(map(int, x.split()))
        if q:
            print((bit.range_sum(p, x)))
        else:
            bit.add(p+1, x)


if __name__ == "__main__":
    main()
# Original solution
def segfunc(x,y):return x+y
ide_ele=0
class segtree():
  def __init__(self,init_val,segfunc=segfunc,ide_ele=ide_ele):
    n=len(init_val)
    self.segfunc=segfunc
    self.ide_ele=ide_ele
    self.num=1<<(n-1).bit_length()
    self.tree=[ide_ele]*2*self.num
    for i in range(n):
      self.tree[self.num+i]=init_val[i]
    for i in range(self.num-1,0,-1):
      self.tree[i]=self.segfunc(self.tree[2*i], self.tree[2*i+1])
  def update(self,k,x):
    k+=self.num
    self.tree[k]+=x
    while k>1:
      self.tree[k>>1]=self.segfunc(self.tree[k],self.tree[k^1])
      k>>=1
  def query(self,l,r):
    res=self.ide_ele
    l+=self.num
    r+=self.num+1
    while l<r:
      if l&1:
        res=self.segfunc(res,self.tree[l])
        l+=1
      if r&1:
        res=self.segfunc(res,self.tree[r-1])
      l>>=1
      r>>=1
    return res
n,q=map(int,input().split())
st=segtree(list(map(int,input().split())))
ans=[]
for _ in range(q):
  x,y,z=map(int,input().split())
  if x:ans+=[st.query(y,z-1)]
  else:st.update(y,z)
print(*ans,sep='\n')


# Optimized solution
class binaryindexedtree():
  def __init__(self,n):
    self.n=n
    self.tree=[0]*n
  def add(self,a,w):
    x=a
    while x<=self.n:
      self.tree[x-1]+=w
      x+=x&(-x)
  def sums(self,a):
    x=a
    S=0
    while x!=0:
      S+=self.tree[x-1]
      x-=x&(-x)
    return S
n,q=map(int,input().split())
a=list(map(int,input().split()))
bit=binaryindexedtree(n)
for i,x in enumerate(a,1):
  bit.add(i,x)
ans=[]
for _ in range(q):
  x,y,z=map(int,input().split())
  if x:ans+=[bit.sums(z)-bit.sums(y)]
  else:bit.add(y+1,z)
print(*ans,sep='\n')
# Original solution
class BIT():

    __slots__ = ["n", "data"]

    def __init__(self, li):
        self.n = len(li) + 1
        self.data = [0] + li
        for i in range(1, self.n):
            if i + (i & -i) < self.n:
                self.data[i + (i & -i)] += self.data[i]

    def add(self, i, a):
        i += 1
        while i < self.n:
            self.data[i] += a
            i += i & -i
        
    def acc(self, i):
        res = 0
        while i > 0:
            res += self.data[i]
            i -= i & -i
        return res
    
    def fold(self, l, r):
        return self.acc(r) - self.acc(l)

import sys
input = sys.stdin.buffer.readline
n, q = list(map(int, input().split()))
A = list(map(int, input().split()))
bit = BIT(A)
for _ in range(q):
    t, p, x = list(map(int, input().split()))
    if t == 0:
        bit.add(p, x)
    else:
        print((bit.fold(p, x)))

# Optimized solution
class BIT():

    __slots__ = ["n", "data"]

    def __init__(self, li):
        self.n = len(li) + 1
        self.data = [0] + li
        for i in range(1, self.n):
            if i + (i & -i) < self.n:
                self.data[i + (i & -i)] += self.data[i]

    def add(self, i, a):
        i += 1
        while i < self.n:
            self.data[i] += a
            i += i & -i
        
    def acc(self, i):
        res = 0
        while i > 0:
            res += self.data[i]
            i -= i & -i
        return res
    
    def fold(self, l, r):
        res = 0
        while l < r:
            res += self.data[r]
            r -= r & -r
        while r < l:
            res -= self.data[l]
            l -= l & -l
        return res

import sys
input = sys.stdin.buffer.readline
n, q = list(map(int, input().split()))
A = list(map(int, input().split()))
bit = BIT(A)
for _ in range(q):
    t, p, x = list(map(int, input().split()))
    if t == 0:
        bit.add(p, x)
    else:
        print((bit.fold(p, x)))
# Original solution
from copy import *
import sys
S=sys.stdin.readlines()

def init(N,node,unit,func):
  n=1
  while n<N:
    n<<=1
  for i in range(n*2-1):
    if len(node)<=i:
      node.append(deepcopy(unit))
    else:
      node[i]=deepcopy(unit)
  node.append(func)
  node.append(unit)
  node.append(n)

def upd(node,x,a):
  y=node[-1]+x
  node[y-1]=a
  while y>1:
    y=y>>1
    node[y-1]=node[-3](node[(y<<1)-1],node[y<<1])

def query(node,l,r):
  x,y=l,r
  z=node[-1]-1
  r=node[-2]
  while True:
    if x==y:
      return r
    if x&1:
      r=node[-3](r,node[x+z])
      x+=1
    if y&1:
      r=node[-3](r,node[y+z-1])
    x>>=1
    y>>=1
    z>>=1
    if z==0:
      return r

def bis_min_k(node,k,cond):
  x=k+1
  while True:
    if node[-1]<=x:
      return x-node[-1]
    if cond(node[(x<<1)-1]):
      x=x<<1
    else:
      x=(x<<1)+1

def bis_min(node,l,r,cond):
  x,y=l,r
  z=node[-1]-1
  for i in range(30):
    if x+(1<<i)>y:
      break
    if x&(1<<i):
      if cond(node[z+(x>>i)]):
        return bis_min_k(node,z+(x>>i),cond)
      x+=(1<<i)
    if z==0:
      break
    z>>=1
  for i in range(29,-1,-1):
    if i and ((node[-1]-1)>>(i-1))==0:
      continue
    if x+(1<<i)>y:
      continue
    if (y-x)&(1<<i):
      if cond(node[((node[-1]-1)>>i)+(x>>i)]):
        return bis_min_k(node,((node[-1]-1)>>i)+(x>>i),cond)
      x+=(1<<i)
  return node[-1]

N,Q=list(map(int,S[0].split()))
A=list(map(int,S[1].split()))
X=[]
init(N+1,X,0,lambda x,y:x+y)
for i in range(N):
  upd(X,i,A[i])
a,b,c=0,0,0
for i in range(Q):
  a,b,c=list(map(int,S[i+2].split()))
  if a:
    print((query(X,b,c)))
  else:
    upd(X,b,X[X[-1]+b-1]+c)

# Optimized solution
import sys
S=sys.stdin.readlines()
def Binit(B,siz):
  while len(B)<siz+1:
    B.append(0)
  while len(B)>siz+1:
    del B[-1]
  for i in range(siz+1):
    B[i]=0
  B.append(siz)

def Badd(B,a,x):
  z=a
  while z<=B[-1]:
    B[z]+=x
    z+=(z&(-z))

def Bsum(B,a):
  r=0
  z=a
  while z>0:
    r+=B[z]
    z-=(z&(-z))
  return r

def Bssum(B,a,b):
  return Bsum(B,max(a,b))-Bsum(B,min(a,b)-1)

BIT=[]
N,Q=list(map(int,S[0].split()))
Binit(BIT,N+1)
A=list(map(int,S[1].split()))
for i in range(N):
  Badd(BIT,i+1,A[i])
a,b,c=0,0,0
for i in range(Q):
  a,b,c=list(map(int,S[i+2].split()))
  if a:
    print((Bssum(BIT,b+1,c)))
  else:
    Badd(BIT,b+1,c)
# Original solution
import sys

class Fenwick_Tree:
    def __init__(self, n):
        self._n = n
        self.data = [0] * n
    
    def add(self, p, x):
        assert 0 <= p < self._n
        p += 1
        while p <= self._n:
            self.data[p - 1] += x
            p += p & -p
    
    def sum(self, l, r):
        assert 0 <= l <= r <= self._n
        return self._sum(r) - self._sum(l)
    
    def _sum(self, r):
        s = 0
        while r > 0:
            s += self.data[r - 1]
            r -= r & -r
        return s


def main():
    input = sys.stdin.readline
    n, q = list(map(int, input().split()))
    fw = Fenwick_Tree(n)
    for i, a in enumerate(map(int, input().split())): fw.add(i, a)
    for _ in range(q):
        t, a, b = list(map(int, input().split()))
        if t == 0:
            fw.add(a, b)
        else:
            print((fw.sum(a, b)))

if __name__ == "__main__":
    main()




# Optimized solution
import sys

class Fenwick_Tree:
    def __init__(self, n):
        self._n = n
        self.data = [0] * n
    
    def add(self, p, x):
        assert 0 <= p < self._n
        p += 1
        while p <= self._n:
            self.data[p - 1] += x
            p += p & -p
    
    def sum(self, l, r):
        assert 0 <= l <= r <= self._n
        return self._sum(r) - self._sum(l)
    
    def _sum(self, r):
        s = 0
        while r > 0:
            s += self.data[r - 1]
            r -= r & -r
        return s


def main():
    input = sys.stdin.readline
    n, q = list(map(int, input().split()))
    fw = Fenwick_Tree(n)
    for i, a in enumerate(map(int, input().split())): fw.add(i, a)
    A = list(map(int, sys.stdin.read().split()))
    for i in range(0, 3 * q, 3):
        t, a, b = A[i:i+3]
        if t == 0:
            fw.add(a, b)
        else:
            print((fw.sum(a, b)))

if __name__ == "__main__":
    main()
# Original solution
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(eval(input()))
    l=list(map(int,input().split()))
    c1=0
    c2=0
    c4=0
    for i in l:
        if i%2==1:
            c1+=1
        else:
            if i%4==0:
                c4+=1
            else:
                c2+=1
    if c2==0:
        if c1<=c4+1:
            print('Yes')
        else:
            print('No')
    else:
        if c1<=c4:
            print('Yes')
        else:
            print('No')
resolve()

# Optimized solution
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(eval(input()))
    l=list(map(int,input().split()))
    cnt1=0
    cnt2=0
    cnt4=0
    for i in l:
        if i%2==1:
            cnt1+=1
        elif i%4==0:
            cnt4+=1
        else:
            cnt2+=1
    if cnt2==0 and cnt4+1>=cnt1:
        print('Yes')
    elif cnt2>0 and cnt4>=cnt1:
        print('Yes')
    else:
        print('No')
resolve()
# Original solution
# def makelist(n, m):
# 	return [[0 for i in range(m)] for j in range(n)]

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


yes = "Yes"
no = "No"


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

four = 0
two = 0
none = 0
for e in a:
	if e % 4 == 0:
		four += 1
	elif e % 2 != 0:
		none += 1
	else:
		two += 1

if four >= none or (two == 0 and four+1 >= none):
	print(yes)
else:
	print(no)


# Optimized solution
N = int(eval(input()))
four = 0
two = 0
one = 0
for e in map(int, input().split()):
    if e % 4 == 0:
        four += 1
    elif e % 2 != 0:
        one += 1
    else:
        two += 1
if four >= one:
    print("Yes")
else:
    if two == 0 and four == one - 1:
        print("Yes")
    else:
        print("No")
# Original solution
import itertools

N= int(eval(input()))
A_list = list(map(int,input().split()))

ans = ''
for v in itertools.permutations(A_list):
    counter = 0
    for i in range(len(v)-1):
        if (v[i]*v[i+1]) % 4 == 0:
            counter += 1
        else:
            break
    if counter + 1 == len(v):
        ans += 'Yes'
        print(ans)
        break
if ans == '':
    print('No')



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

dic = {4: 0, 2: 0, 1: 0}
for i in A_list:
    if i % 4 == 0:
        dic[4] += 1
    elif i % 2 == 0:
        dic[2] += 1
    else:
        dic[1] += 1
dic[4] += dic[2] // 2

if len(A_list) // 2 <= dic[4]:
    print('Yes')
else:
    print('No')
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

cnt = 0
for a in A:
    if a % 4 == 0: cnt += 1
    elif a % 2 == 0: cnt += 0.5
print(("Yes" if cnt >= N // 2 else "No"))

# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
for a in A:
  if a%4==0: cnt += 1
  elif a%2==0: cnt += 0.5
cnt = int(cnt)

print(("Yes" if n//2 <= cnt else "No"))
# Original solution
n = int(eval(input()))
A = list(map(int, input().split()))

checker = []
for a in A:
    cnt = 0
    if a % 2 == 0:
        cnt = 1
    if a % 4 == 0:
        cnt += 1
    checker.append(cnt)

count_2 = checker.count(2)
count_1 = checker.count(1)
count_0 = checker.count(0)

if (count_0 <= count_2+1 and count_0 + count_1 <= count_2 + 1) or count_0 == count_2:
    answer = 'Yes'
else:
    answer = 'No'

print(answer)


# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))
cnt4 = 0
cnt2 = 0
other = 0
for a in A:
    if a % 4 == 0:
        cnt4 += 1
        continue
    if a % 2 == 0:
        cnt2 += 1
    else:
        other += 1
if cnt4+1 >= cnt2 + other or cnt4 >= other:
    print('Yes')
else:
    print('No')
# Original solution
import random

N = int(eval(input()))
num = list(map(int, input().split()))
count = 0

for i in num:
    if i%4==0:
        N -= 2
    elif i%2==0:
        count += 1
if count>1:
    N = N - count + 1

if N > 1:
    print('No')
else:
    print('Yes') 

# Optimized solution
N = int(eval(input()))
num = list(map(int, input().split()))
count = 0

for i in num:
    if i%4==0:
        N -= 2
    elif i%2==0:
        count += 1
if count>1:
    N = N - count + 1

if N > 1:
    print('No')
else:
    print('Yes')
# Original solution
import collections
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n = int(eval(input()))
A = list(map(int, input().split()))
f2 = 0
f4 = 0
for a in A:
    c = collections.Counter(prime_factorize(a))
    if c[2] == 1:
        f2 += 1
    elif c[2] >= 2:
        f4 += 1
if n -f2//2 *2 -f4 *3 <= 0:
    print('Yes')
else:
    print('No')

# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))
f2 = 0
f4 = 0
f_another = 0
for a in A:
    #c = collections.Counter(prime_factorize(a))
    if a%4 == 0:
        f4 += 1
    elif a%2 == 0:
        f2 += 1
    else:
        f_another +=1
if n%2 == 0 and (n -f2//2 *2 -f4 *2 <= 0):
    print('Yes')
elif n%2 == 1 and (n -f2//2 *2 -f4 *2 <= 1):
    print('Yes')
else:
    print('No')
# Original solution

n = int(eval(input()))
cnt2 = 0
cnt4 = 0
A = list(map(int, input().split()))
for a in A:
    if a % 4 == 0:
        cnt4 += 1
    elif a % 2 == 0:
        cnt2 += 1
odd = n - cnt2 - cnt4
if cnt2 != 0:
    odd += 1

if odd - 1 > cnt4:
    print("No")
else:
    print("Yes")


# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))
div = 0
even = 0
for a in A:
    if a % 4 == 0:
        div += 1
    elif a % 2 == 0:
        even += 1

odd = n - div - even
if even:
    odd += 1
if div:
    div += 1

if div >= odd or even == n:
    print("Yes")
else:
    print("No")
# Original solution
n = int(eval(input()))
As = list(map(int, input().split()))

four = sum([1 for a in As if a%4 == 0])
odd = sum([1 for a in As if a%2 == 1])
two = sum([1 for a in As if a%2 == 0 and a%4 != 0])
if four < two%2 + odd - 1:
    print("No")
else:
    print("Yes")

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

# four = sum([1 for a in As if a%4 == 0])
# odd = sum([1 for a in As if a%2 == 1])
# two = sum([1 for a in As if a%2 == 0 and a%4 != 0])
four = 0
odd = 0
two = 0
for a in As:
    if a % 2 == 1:
        odd += 1
    elif a % 4 == 0:
        four += 1
    else:
        two += 1


if four < two%2 + odd - 1:
    print("No")
else:
    print("Yes")
# Original solution
import sys
n = int(sys.stdin.readline().strip())
ar = [int(x) for x in sys.stdin.readline().split()]
stop = False

def ok(x, y):
	if x == -1: return True
	return (x*y)%4 == 0

def find(ctr, prev, mask, app):
	global stop
	if ctr == n:
		stop = True
	if stop == True: return
	for i in range(n):
		if mask[i] and ok(prev, ar[i]):
			mask[i] = False
			find(ctr+1, ar[i], mask, app + [ar[i]])
			mask[i] = True

find(0, -1, [True]*n, [])
print("Yes" if stop else "No")

# Optimized solution
import sys
n = int(sys.stdin.readline().strip())
ar = [int(x) for x in sys.stdin.readline().split()]
f4, odd, even = 0, 0, 0
for num in ar:
	if num%4==0:
		f4 +=1
	elif num%2==0:
		even+=1
	else:
		odd+=1
if odd-f4 == 0:
	print("Yes")
elif odd-f4 <= 1 and even == 0:
	print("Yes")
else:
	print("No")
# Original solution
from collections import Counter

N = int(eval(input()))
A = [int(i) for i in input().split()]
C = Counter(4 if a % 4 == 0 else 2 if a % 2 == 0 else 1 for a in A)

if C[2] == 0:
    print(("Yes" if C[1] <= C[4] + 1 else "No"))
else:
    print(("Yes" if C[1] <= C[4] else "No"))


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

def solve():
    f, t, o = 0, 0, 0
    for a in A:
        if a % 4 == 0:
            f += 1
        elif a % 2 == 0:
            t += 1
        else:
            o += 1

    if t == 0:
        return (o <= f + 1)
    else:
        return (o <= f)

if solve():
    print("Yes")
else:
    print("No")
# Original solution
N = int(eval(input()))
A = [int(i) for i in input().split()]

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

if N - f - t <= f + (t == 0):
    print("Yes")
else:
    print("No")


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

f, t = A.count(0), A.count(2)
if N - f - t <= f + (t == 0):
    print("Yes")
else:
    print("No")
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

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

#print(n1, n2, n4)
print((["Yes", "No"][not(n1 + (n2 % 2) <= n4 + 1)]))


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

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

#print(n1, n2, n4)
print((["Yes", "No"][not(n1 + n2 <= n4 + 1)]))
# Original solution
n = int(eval(input()))
cou1 = 0
cou2 = 0
cou4 = 0
lis = list(map(int,input().split()))
for i in range(n):
    if lis[i] % 2 == 0:
        if lis[i] % 4 == 0:
            cou4 += 1
        else:
            cou2 += 1
    else:
        cou1 += 1
if cou2 == 0:
    if cou1 <= cou4 + 1:
        print("Yes")
    else:
        print("No")
else:
    if cou1 <= cou4:
        print("Yes")
    else:
        print("No")

# Optimized solution
n = int(eval(input()))
lis = list(map(int,input().split()))
nu1 = 0
nu2 = 0
nu4 = 0
for nu in lis:
    if nu % 2 == 0:
        if nu % 4 == 0:
            nu4 += 1
        else:
            nu2 = 1
    else:
        nu1 += 1
if nu4 + 1 >= nu1 + nu2:print("Yes")
else:print("No")