AtCoder Beginner Contest 069 - 4-adjacent

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-----
3
1 10 100

-----Sample Output-----
Yes

One solution is (1, 100, 10).

Difficulty: EASY

Starter code:

Solutions:
input()
(a, b1, b2, b4, r) = (list(map(int, input().split())), 0, 0, 0, 'NYoe s')
for i in a:
	if i % 2 != 0:
		b1 += 1
	elif i % 4 == 0:
		b4 += 1
	else:
		b2 += 1
print([r[b1 <= b4::2], r[b1 <= b4 + 1::2]][not b2])


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


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


(_, *l) = map(int, open(0).read().split())
o = t = 0
for i in l:
	o += i % 2
	t += i % 4 > 0
print('YNeos'[(t > o) + o > len(l) - t + 1::2])


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


(n, *aa) = map(int, open(0).read().split())
odd = sum([a % 2 for a in aa])
quad = sum([a % 4 == 0 for a in aa])
if odd <= quad or (odd == quad + 1 and odd + quad == len(aa)):
	print('Yes')
else:
	print('No')


N = int(input())
a = list(map(int, input().strip().split()))
even = 0
odd = 0
four = 0
for n in range(N):
	if a[n] % 4 == 0:
		four += 1
	elif a[n] % 2 == 0:
		even += 1
	else:
		odd += 1
if odd == 0:
	print('Yes')
elif even == 0:
	if four >= odd - 1:
		print('Yes')
	else:
		print('No')
elif four >= odd:
	print('Yes')
else:
	print('No')


input()
(a, b, c, d, r) = (list(map(int, input().split())), 0, 0, 0, 'NYoe s')
for i in a:
	if i % 2 != 0:
		b += 1
	elif i % 4 == 0:
		c += 1
	else:
		d += 1
print([r[b <= c::2], r[b <= c + 1::2]][not d])


n = int(input())
a = map(int, input().split())
cnt = 0
twocnt = 0
for i in a:
	if i % 4 == 0:
		cnt += 1
	elif i % 2 == 0:
		twocnt += 1
cnt += twocnt // 2
if cnt >= n // 2:
	print('Yes')
else:
	print('No')


n = int(input())
m = list(map(int, input().split()))
l = filter(lambda x: x % 4 == 0, m)
o = filter(lambda x: x % 2 == 0 and x % 4 != 0, m)
if n // 2 <= len(list(l)) + len(list(o)) // 2:
	print('Yes')
else:
	print('No')


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


n = int(input())
l = list(map(int, input().split()))
(x, y, z) = (0, 0, 0)
for a in l:
	if a % 4 == 0:
		z += 1
	elif a % 2 == 0:
		y += 1
	else:
		x += 1
if y > 0:
	x += 1
print('Yes' if x <= z + 1 else 'No')


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


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
amod4 = list([x % 4 for x in a])
d = Counter(amod4)
if n - d[0] - d[2] < d[0] + 1:
	print('Yes')
elif d[2] == 0 and n == 2 * d[0] + 1:
	print('Yes')
else:
	print('No')


n = int(input())
a_lst = list(map(int, input().split()))
cnt = 0
for a in a_lst:
	if a % 4 == 0:
		cnt += 2
	elif a % 2 == 0:
		cnt += 1
	else:
		pass
if cnt // 2 >= n // 2:
	print('Yes')
else:
	print('No')


N = int(input())
a = [int(x) for x in input().split()]
cnt4 = 0
cnt2 = 0
for x in a:
	if x % 4 == 0:
		cnt4 += 1
		continue
	if x % 2 == 0:
		cnt2 += 1
cnt2 = cnt2 // 2 * 2
if N - cnt2 > 2 * cnt4 + 1:
	print('No')
else:
	print('Yes')


n = int(input())
a = list(map(int, input().split()))
one = 0
four = 0
two = 0
for i in range(n):
	cnt = 0
	num = a[i]
	while num % 2 == 0:
		cnt += 1
		num //= 2
	if cnt == 0:
		pin = 1
	elif cnt == 1:
		pin = 2
	else:
		pin = 4
	if pin == 1:
		one += 1
	elif pin == 4:
		four += 1
	else:
		two += 1
if two > 0:
	one += 1
if one <= four + 1:
	print('Yes')
else:
	print('No')


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


N = int(input())
a = list(map(int, input().split()))
b = [a[i] % 4 for i in range(N)]
if b.count(2) % 2 + b.count(1) + b.count(3) > 1 + b.count(0):
	print('No')
else:
	print('Yes')


n = int(input())
li = list(map(int, input().split()))
lis = []
x = 0
y = 0
z = 0
for i in range(n):
	if li[i] % 4 == 0:
		x += 1
	elif li[i] % 2 == 0:
		y = 1
	else:
		z += 1
if y == 0:
	if x + 1 >= z:
		print('Yes')
	else:
		print('No')
elif x >= z:
	print('Yes')
else:
	print('No')


N = int(input())
a = b = c = 0
for x in map(int, input().split()):
	if x % 4 == 0:
		a += 1
	elif x % 2 == 0:
		b += 1
print(['No', 'Yes'][a + b // 2 >= N // 2])


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


n = int(input())
a = [int(i) for i in input().split()]
(f, t) = (0, 0)
for ai in a:
	if ai % 4 == 0:
		f += 1
	elif ai % 2 == 0:
		t += 1
r = n - 2 * f
if r - 1 <= 0 or r <= t:
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
n2 = 0
n4 = 0
for i in range(n):
	if a[i] % 4 == 0:
		n4 += 1
	elif a[i] % 2 == 0:
		n2 += 1
ok = True
if n2 == 0:
	if n4 >= n // 2:
		ok = True
	else:
		ok = False
else:
	n1 = n - n2 - n4
	n1 += 1
	nn = n1 + n4
	if n4 >= nn // 2:
		ok = True
	else:
		ok = False
if ok:
	print('Yes')
else:
	print('No')


N = int(input())
A = tuple(map(lambda num: min(2, format(int(num), 'b')[::-1].index('1')), input().split()))
n2 = A.count(2)
print('Yes' if n2 * 2 >= N - N % 2 or sum(A) >= N else 'No')


n = int(input())
a = list(map(int, input().split()))
a4 = []
a2 = []
a1 = []
for i in range(n):
	if a[i] % 4 == 0:
		a4.append(a[i])
	elif a[i] % 2 == 0:
		a2.append(a[i])
	else:
		a1.append(a[i])
if len(a4) >= n // 2:
	print('Yes')
elif len(a4) + len(a2) // 2 >= n // 2:
	print('Yes')
else:
	print('No')


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


N = int(input())
ans = 0
for i in list(map(int, input().split())):
	if i % 4 == 0:
		ans += 1
	elif i % 2 != 0:
		ans -= 1
if N % 2 != 0:
	ans += 1
print('Yes' if ans >= 0 else 'No')


n = int(input())
a = list(map(int, input().split()))
o = 0
f = 0
for i in a:
	if i % 4 == 0:
		f += 1
	elif i % 2 != 0:
		o += 1
if len(a) == f + o:
	f += 1
print('Yes' if f >= o else 'No')


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)


n = int(input())
a = list(map(int, input().split()))
i2 = 0
i4 = 0
for i in range(n):
	if a[i] % 4 == 0:
		i4 += 1
	if a[i] % 2 == 0:
		i2 += 1
if n // 2 <= i4:
	print('Yes')
else:
	tmp = n // 2
	if n % 2 == 0:
		if (tmp - i4) * 2 <= i2 - i4:
			print('Yes')
		else:
			print('No')
	elif (tmp - i4) * 2 + 1 <= i2 - i4:
		print('Yes')
	else:
		print('No')


n = int(input())
n1 = 0
n2 = 0
n4 = 0
for a in map(int, input().split()):
	if a % 4 == 0:
		n4 += 1
	elif a % 2 == 0:
		n2 += 1
	else:
		n1 += 1
if n1 <= n4:
	print('Yes')
elif n1 == n4 + 1 and n2 == 0:
	print('Yes')
else:
	print('No')


N = int(input())
A = list(map(int, input().split()))
tmp = [a % 4 for a in A]
four = tmp.count(0)
two = tmp.count(2)
if four + two // 2 >= N // 2:
	print('Yes')
else:
	print('No')


from sys import exit
N = int(input())
A = [int(x) for x in input().split()]
m1 = 0
m2 = 0
m4 = 0
for a in A:
	if a % 4 == 0:
		m4 += 1
	elif a % 2 == 0:
		m2 += 1
	else:
		m1 += 1
m1 = m1 + (m2 > 0)
if m4 >= m1 - 1:
	print('Yes')
else:
	print('No')


_ = int(input())
a = list(map(int, input().split()))
(x, y, z) = (0, 0, 0)
for i in a:
	if i % 4 == 0:
		z += 1
	elif i % 2 == 0:
		y += 1
	else:
		x += 1
if y:
	if x <= z:
		print('Yes')
	else:
		print('No')
elif x <= z + 1:
	print('Yes')
else:
	print('No')


n = int(input())
a = [int(i) for i in input().split()]
count2 = 0
count4 = 0
for i in a:
	if i % 4 == 0:
		count4 += 1
		continue
	if i % 2 == 0:
		count2 += 1
if count2 != 0:
	n -= count2 - 1
if count4 >= int(n / 2):
	print('Yes')
else:
	print('No')


N = int(input())
a = list(map(int, input().split()))
count = 0
hcount = 0
for x in a:
	if x % 4 == 0:
		count += 1
	elif x % 2 == 0:
		hcount += 1
if count + hcount // 2 >= N // 2:
	print('Yes')
else:
	print('No')


N = int(input())
(*A,) = map(int, input().split())
i1 = len([i for i in A if i % 2 != 0])
i4 = len([i for i in A if i % 4 == 0])
i2 = min(1, N - i1 - i4)
print('Yes' if i1 + i2 - 1 <= i4 else 'No')


N = int(input())
a = list(map(int, input().split()))
f = []
t = []
o = []
ans = 'No'
for i in a:
	if i % 4 == 0:
		f.append(i)
	elif i % 2 == 0:
		t.append(i)
	else:
		o.append(i)
if len(t) == 0:
	if len(o) <= len(f) + 1:
		ans = 'Yes'
elif len(o) <= len(f):
	ans = 'Yes'
print(ans)


n = int(input())
c = list(map(int, input().split()))
a = 0
a2 = 0
a4 = 0
for i in c:
	if i % 2 != 0:
		a += 1
	if i % 2 == 0 and i % 4 != 0:
		a2 += 1
	if i % 4 == 0:
		a4 += 1
if a == 0:
	print('Yes')
if a > 0 and a2 == 0:
	if a <= a4 + 1:
		print('Yes')
	else:
		print('No')
if a > 0 and a2 > 0:
	if a <= a4:
		print('Yes')
	else:
		print('No')


n = int(input())
a = list(map(int, input().split()))
(j2, j4) = (0, 0)
for x in a:
	if x % 4 == 0:
		j4 += 1
	elif x % 2 == 0:
		j2 += 1
if n % 2 == 0:
	print('Yes' if j2 + 2 * j4 >= n else 'No')
else:
	print('Yes' if j2 + 2 * j4 >= n - 1 else 'No')


n = int(input())
A = list(map(int, input().split()))
multi_4 = 0
multi_2 = 0
odd = 0
for a in A:
	if a % 4 == 0:
		multi_4 += 1
	elif a % 2 == 0:
		multi_2 += 1
	else:
		odd += 1
if multi_2 > 0:
	if odd > multi_4:
		print('No')
	else:
		print('Yes')
elif odd > multi_4 + 1:
	print('No')
else:
	print('Yes')


(n, *a_l) = map(int, open(0).read().split())
multi_4 = sum([1 for a in a_l if a % 4 == 0])
multi_2 = sum([1 for a in a_l if a % 2 == 0]) - multi_4
multi_1 = n - (multi_2 + multi_4)
print('Yes' if multi_2 % 2 + multi_1 <= multi_4 + 1 else 'No')


n = int(input())
a = list(map(int, input().split()))
c4 = sum((1 for x in a if x % 4 == 0))
c1 = sum((1 for x in a if x % 2 == 1))
if c4 >= c1 or (c4 >= c1 - 1 and c4 + c1 == n):
	print('Yes')
else:
	print('No')


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')
elif n // 2 * 2 - n4 * 2 <= n2:
	print('Yes')
else:
	print('No')


N = int(input())
A = [int(s) for s in input().split()]
mod4 = [a % 4 for a in A]
a1 = mod4.count(1) + mod4.count(3)
a4 = mod4.count(0)
ans = True if a1 == a4 + 1 and a1 + a4 == N or a1 <= a4 else False
print('Yes' if ans else 'No')


N = int(input())
a = [int(i) for i in input().split()]
ki = 0
gu_2 = 0
gu_4 = 0
for i in a:
	if i % 4 == 0:
		gu_4 += 1
	elif i % 2 == 0:
		gu_2 += 1
	else:
		ki += 1
if ki <= gu_4:
	print('Yes')
elif gu_4 + 1 == ki and gu_4 + ki == N:
	print('Yes')
else:
	print('No')


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


(_, *l) = [int(i) % 4 for i in open(0).read().split()]
f = l.count
print('YNeos'[f(0) + f(2) // 2 < len(l) // 2::2])


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


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
zero = a.count(0)
one = a.count(1)
two = a.count(2)
if zero > two + 1:
	print('No')
elif zero == two + 1:
	if zero + two == N:
		print('Yes')
	else:
		print('No')
else:
	print('Yes')


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


n = int(input())
L = list(map(int, input().split()))
a = 0
b = 0
for i in range(n):
	if L[i] % 4 == 0:
		b += 1
	if L[i] % 2 == 1:
		a += 1
if a + b == n and a - b == 1:
	print('Yes')
	return
if b >= a:
	print('Yes')
else:
	print('No')


n = int(input())
A = list(map(int, input().split()))
B = [0] * 3
for i in A:
	if i % 4 == 0:
		B[0] += 1
	elif i % 2 == 0:
		B[1] += 1
	else:
		B[2] += 1
print('Yes' if B[0] == 0 and B[2] == 0 or B[0] >= B[2] or (B[1] == 0 and B[2] - B[0] == 1) else 'No')


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)


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
f = c4 * 2 + 1
if f >= N or f + c2 - 1 >= N:
	print('Yes')
else:
	print('No')


N = int(input())
N_List = list(map(int, input().split()))
Four_List = [i for i in N_List if i % 4 == 0]
Two_List = [i for i in N_List if i % 2 == 0]
if len(Two_List) - len(Four_List) > 0:
	N = N - (len(Two_List) - len(Four_List)) + 1
if N // 2 <= len(Four_List):
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
t = [0 for _ in range(3)]
for i in range(n):
	if a[i] % 2 == 0:
		if a[i] % 4 == 0:
			t[2] += 1
		else:
			t[1] += 1
	else:
		t[0] += 1
if t[0] + t[1] % 2 <= t[2] + 1:
	print('Yes')
else:
	print('No')


import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
odd = np.count_nonzero(A % 2 != 0)
four = np.count_nonzero(A % 4 == 0)
ans = 'No'
if odd == 1 and four >= 1:
	ans = 'Yes'
elif odd == 2 and four >= 2:
	ans = 'Yes'
elif odd + four == N and odd - 1 <= four:
	ans = 'Yes'
elif odd <= four:
	ans = 'Yes'
print(ans)


N = int(input())
a = list(map(int, input().split()))
alen = N
two = 0
four = 0
for aa in a:
	if aa % 4 == 0:
		four += 1
	elif aa % 2 == 0:
		two += 1
other = alen - two - four
res = False
if other > four + 1:
	pass
elif other == four + 1:
	if two == 0:
		res = True
else:
	res = True
if res:
	print('Yes')
else:
	print('No')


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 2 * four + 1 >= n:
	print('Yes')
elif 2 * four + two >= n:
	print('Yes')
else:
	print('No')


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


N = int(input())
a = list(map(int, input().split()))
cnt2 = 0
cnt4 = 0
cntodd = 0
for i in a:
	if i % 4 == 0:
		cnt4 += 1
	elif i % 2 == 0:
		cnt2 += 1
	else:
		cntodd += 1
if cnt2 == 0 and cnt4 + 1 >= cntodd:
	ans = 'Yes'
elif cnt4 >= cntodd:
	ans = 'Yes'
else:
	ans = 'No'
print(ans)


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
	elif a[i] % 2 == 0:
		num2 += 1
if n - num4 * 2 <= 1:
	print('Yes')
elif n - num4 * 2 <= num2:
	print('Yes')
else:
	print('No')


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


n = int(input())
hoge = list(map(int, input().split()))
(d0, d2, d4) = (0, 0, 0)
for i in range(n):
	if hoge[i] % 4 == 0:
		d4 += 1
	elif hoge[i] % 2 == 0:
		d2 += 1
	else:
		d0 += 1
if d2 != 0:
	d0 += 1
if d0 - d4 > 1:
	print('No')
else:
	print('Yes')


n = int(input())
A = list(map(int, input().split()))
ans4 = 0
ans2 = 0
for a in A:
	if a % 4 == 0:
		ans4 += 1
	elif a % 2 == 0:
		ans2 += 1
ans2 = ans2 - ans2 % 2
if (n - ans2) // 2 <= ans4:
	print('Yes')
else:
	print('No')


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


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')
elif len(W) >= n - len(Q) * 2:
	print('Yes')
else:
	print('No')


import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda : int(sys.stdin.readline())
inl = lambda : [int(x) for x in sys.stdin.readline().split()]
ins = lambda : sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print('\x1b[33m', *a, '\x1b[0m', **dict(file=sys.stderr, **kw))

def solve():
	n = ini()
	a = inl()
	(c4, c2) = (0, 0)
	for x in a:
		if x % 4 == 0:
			c4 += 1
		elif x % 2 == 0:
			c2 += 1
	c1 = n - c2 - c4
	if c4 == 0:
		return c1 == 0 and c2 >= 2
	return c4 >= c1 or (c4 + 1 == c1 and c2 == 0)
print('Yes' if solve() else 'No')


input()
l = [int(i) % 4 for i in input().split()]
f = l.count
print('YNeos'[f(0) + f(2) // 2 < len(l) // 2::2])


(n, *a) = map(int, open(0).read().split())
a = [i % 4 for i in a]
if a.count(2) > 0:
	print('Yes' if a.count(0) >= a.count(1) + a.count(3) else 'No')
else:
	print('Yes' if 1 + a.count(0) >= a.count(1) + a.count(3) else 'No')


n = int(input())
a_ls = list(map(int, input().split()))
n_4k = 0
n_2k = 0
n_odd = 0
for i in range(n):
	if a_ls[i] % 4 == 0:
		n_4k += 1
	elif a_ls[i] % 2 == 0:
		n_2k += 1
	else:
		n_odd += 1
res = 'No'
if n_odd == 0:
	res = 'Yes'
elif n_2k > 0:
	if n_odd <= n_4k:
		res = 'Yes'
elif n_odd <= n_4k + 1:
	res = 'Yes'
print(res)


with open(0) as f:
	(N, *a) = map(int, f.read().split())
(i, j, k) = (0, 0, 0)
for x in a:
	if x % 4 == 0:
		i += 1
	elif x % 2 == 0:
		j += 1
	else:
		k += 1
if j > 0:
	k += 1
print('Yes' if k <= i + 1 else 'No')


(n, *a) = map(int, open(0).read().split())
s = [i % 4 for i in a]
(f, t) = (s.count(0), s.count(2))
print('YNeos'[n - f - t + (t > 0) > f + 1::2])


from fractions import gcd
from itertools import combinations, permutations, accumulate, product
from collections import deque, defaultdict, Counter
import decimal
import re
import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7

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

def I():
	return int(input())
n = I()
A = readInts()
four = 0
two = 0
for i in range(n):
	if A[i] % 4 == 0:
		four += 1
	elif A[i] % 2 == 0:
		two += 1
print('Yes' if four + two // 2 >= n // 2 else 'No')


n = int(input())
ns = map(int, input().split())
four = [0, 0, 0, 0]
for i in ns:
	four[i % 4] += 1
if four[2] == 0 and n - 1 - 2 * four[0] <= 0:
	print('Yes')
elif n - four[2] - 2 * four[0] <= 0:
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
ans = [0] * 3
for i in a:
	if i % 4 == 0:
		ans[2] += 1
	elif i % 2 == 0:
		ans[1] += 1
	else:
		ans[0] += 1
print(['No', 'Yes'][ans[0] + (ans[1] > 0) <= ans[2] + 1])


n = int(input())
a = [int(i) for i in input().split()]
A_num = 0
B_num = 0
C_num = 0
for i in a:
	if i % 4 == 0:
		C_num += 1
	elif i % 2 == 0:
		B_num += 1
	else:
		A_num += 1

def ans():
	if A_num == 1:
		if C_num >= 1:
			return True
		return False
	elif n == 2 * A_num - 1:
		if C_num == A_num - 1:
			return True
		return False
	elif n < 2 * A_num - 1:
		return False
	else:
		if C_num >= A_num:
			return True
		return False
if ans():
	print('Yes')
else:
	print('No')


N = int(input())
a = list(map(int, input().split()))
(n4, n2) = (0, 0)
for i in range(N):
	if a[i] % 4 == 0:
		n4 += 1
	elif a[i] % 2 == 0:
		n2 += 1
if n4 >= N // 2:
	print('Yes')
elif n4 * 2 + n2 >= N:
	print('Yes')
else:
	print('No')


N = int(input())
A = list(map(int, input().split()))
X = [0, 0, 0]
for i in range(len(A)):
	if A[i] % 4 == 0:
		X[2] += 1
	elif A[i] % 2 == 0:
		X[1] += 1
	else:
		X[0] += 1
if 2 * X[2] + 1 >= N:
	print('Yes')
elif 2 * X[2] + X[1] >= N:
	print('Yes')
else:
	print('No')


(_, *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')


import itertools
n = int(input())
a = list(map(int, input().split()))
four = len([1 for i in a if i % 4 == 0])
two = len([1 for i in a if i % 2 == 0]) - four
four += two // 2
if four >= n - four - 1:
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
x4 = 0
x2 = 0
for i in a:
	if i % 4 == 0:
		x4 += 1
	elif i % 2 == 0:
		x2 += 1
if x4 * 2 + x2 >= n or x4 >= n // 2:
	print('Yes')
else:
	print('No')


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


n = int(input())
a = list(map(int, input().split()))
(cnt1, cnt2) = (0, 0)
for i in a:
	if i % 4 == 0:
		cnt1 += 1
	elif i % 2 == 0:
		cnt2 += 1
if cnt2 > 0:
	tmp = n - cnt2 + 1
else:
	tmp = n
if cnt1 >= tmp // 2:
	print('Yes')
else:
	print('No')


N = int(input())
A = [int(x) for x in input().split()]
c_2 = 0
c_4 = 0
for i in range(N):
	if A[i] % 4 == 0:
		c_4 += 1
	elif A[i] % 2 == 0 and A[i] % 4 != 0:
		c_2 += 1
c = N - c_4 - c_2
print('Yes' if c_2 == 0 and c_4 >= c - 1 or c_4 >= c else 'No')


N = int(input())
A = list(map(int, input().split()))
b = len([a for a in A if a % 4 == 0])
c = len([a for a in A if a % 2])
d = len([a for a in A if a % 2 == 0 and a % 4])
print('YNeos'[not (b >= c if d else b >= c - 1)::2])


N = int(input())
A = list(map(int, input().split()))
min_four = N // 2
four_count = 0
for a in A:
	if a % 4 == 0:
		four_count += 4
	elif a % 2 == 0:
		four_count += 2
if min_four * 4 <= four_count:
	print('Yes')
else:
	print('No')


N = int(input())
A = list(map(int, input().split()))
x = 0
y = 0
for a in A:
	if a % 4 == 0:
		x += 1
	elif a % 2 == 0:
		y += 1
print(['No', 'Yes'][x + y // 2 >= N // 2])


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


N = int(input())
a = list(map(int, input().split()))
sa = []
c = [0] * 4
ans = 'No'
for i in a:
	sa.append(i % 4)
for i in sa:
	c[i] += 1
if c[2] == 0:
	if c[1] + c[3] <= c[0] + 1:
		ans = 'Yes'
elif c[1] + c[3] <= c[0]:
	ans = 'Yes'
print(ans)


n = int(input())
A = list(map(int, input().split()))
(d, q, x) = (0, 0, 0)
for a in A:
	if a % 4 == 0:
		q += 1
	elif a % 2 == 0:
		d += 1
	else:
		x += 1
x += d % 2
d -= d % 2
if q + 1 >= x:
	print('Yes')
else:
	print('No')


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


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


def main():
	n = int(input())
	a = [int(an) for an in input().split()]
	exist2 = False
	not4 = 0
	count4 = 0
	for an in a:
		if an % 2 == 0:
			if an % 4 == 0:
				count4 += 1
			elif not exist2:
				exist2 = True
				not4 += 1
		else:
			not4 += 1
	print('Yes' if count4 >= not4 - 1 else 'No')

def __starting_point():
	main()
__starting_point()


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	a[i] %= 4
if a.count(0) >= n // 2:
	print('Yes')
elif n - a.count(0) * 2 <= a.count(2):
	print('Yes')
else:
	print('No')


n = int(input())
l = list(map(int, input().split()))
count2 = 0
count4 = 0
for i in range(n):
	if l[i] % 4 == 0:
		count4 += 1
	elif l[i] % 2 == 0:
		count2 += 1
if count4 * 2 + count2 >= n or count4 * 2 + 1 >= n:
	print('Yes')
else:
	print('No')


N = int(input())
A = list(map(int, input().split()))
B = []
for a in A:
	B.append(a % 4)
ans = 'No'
if B.count(0) >= B.count(1) + B.count(3):
	ans = 'Yes'
if B.count(2) == 0 and B.count(0) == B.count(1) + B.count(3) - 1:
	ans = 'Yes'
print(ans)


from collections import Counter
n = int(input())
A = list(map(int, input().split()))
A = [min(x & -x, 4) for x in A]
CA = Counter(A)
num0 = CA[1]
num1 = CA[2]
num2 = CA[4]
if num1:
	num1 = 1
if num2 - (num1 + num0) >= -1:
	print('Yes')
else:
	print('No')


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def main():
	(N, *A) = list(map(int, read().split()))
	m = sum((1 for a in A if a % 2 == 1))
	n2 = sum((1 for a in A if a % 2 == 0 and a % 4 != 0))
	n4 = sum((1 for a in A if a % 4 == 0))
	if m <= n4:
		print('Yes')
	elif m == n4 + 1:
		if n2 == 0:
			print('Yes')
		else:
			print('No')
	else:
		print('No')
	return

def __starting_point():
	main()
__starting_point()


data = int(input())
array = [int(i) for i in input().split()]
div2 = 0
div4 = 0
for i in array:
	if i % 4 == 0:
		div4 += 1
	elif i % 2 == 0:
		div2 += 1
if data - max(div2 - 1, 0) <= div4 * 2 + 1:
	print('Yes')
else:
	print('No')


N = int(input())
nums = list(map(int, input().split()))
two = 0
four = 0
for num in nums:
	if num % 4 == 0:
		four += 1
	elif num % 2 == 0:
		two += 1
if four + two // 2 >= N // 2:
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
x = 0
y = 0
for i in a:
	if i % 2 != 0:
		x += 1
	elif i % 4 == 0:
		y += 1
if y >= x:
	print('Yes')
	return
elif x + y == len(a) and y == x - 1:
	print('Yes')
else:
	print('No')


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)


N = int(input())
A = list(map(int, input().split()))
mod0 = 0
mod2 = 0
mod13 = 0
for a in A:
	mod = a % 4
	if mod == 0:
		mod0 += 1
	elif mod == 2:
		mod2 += 1
	else:
		mod13 += 1
if mod2 > 0:
	if mod13 <= mod0:
		print('Yes')
	else:
		print('No')
elif mod13 - 1 <= mod0:
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
count4 = 0
count2 = 0
for i in range(n):
	if a[i] % 4 == 0:
		count4 += 1
	elif a[i] % 2 == 0:
		count2 += 1
count = count4 + count2 // 2
must = n // 2
if count >= must:
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
c4 = 0
ce = 0
for i in a:
	if i % 4 == 0:
		c4 += 1
	elif i % 2 == 0:
		ce += 0.5
if c4 + int(ce) >= n // 2:
	print('Yes')
else:
	print('No')


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


_ = input()
a = [int(x) for x in input().split()]
odd = []
m4 = []
m2 = 0
for i in a:
	if i % 2 != 0:
		odd.append(i)
	elif i % 4 == 0:
		m4.append(i)
	else:
		m2 = 1
else:
	lodd = len(odd)
	if lodd == 0 or lodd + m2 - 1 <= len(m4):
		print('Yes')
	else:
		print('No')


(n, *A) = map(int, open(0).read().split())
p = sum((a % 2 < 1 for a in A))
q = sum((a % 4 < 1 for a in A))
print('Yes' * (q == p > n - p - 2 or n - p <= q) or 'No')


n = int(input())
a = list(map(int, input().split()))
(t, f) = (0, 0)
for x in a:
	if x % 4 == 0:
		f += 1
	elif x % 2 == 0:
		t += 1
print('Yes' if max(0, t - 1) + f * 2 + 1 >= n else 'No')


(N, *A) = map(int, open(0).read().split())
x = y = 0
for a in A:
	if a % 4 == 0:
		x += 1
	elif a % 2 == 0:
		y += 1
print(['No', 'Yes'][x + y // 2 >= N // 2])


n = int(input())
arr = list(map(int, input().split()))
odd_num = len([e for e in arr if e % 2 != 0])
four_num = len([e for e in arr if e % 4 == 0])
even_num = n - odd_num - four_num
if even_num:
	print('Yes' if four_num >= odd_num else 'No')
else:
	print('Yes' if four_num >= odd_num - 1 else 'No')


n = int(input())
a = list(map(int, input().split()))
codd = 0
cfour = 0
for i in range(n):
	if a[i] % 2 != 0:
		codd += 1
	if a[i] % 4 == 0:
		cfour += 1
ceven = n - cfour - codd
if cfour >= codd:
	print('Yes')
elif ceven == 0 and cfour + 1 == codd:
	print('Yes')
else:
	print('No')


(n, *A) = map(int, open(0).read().split())
C = [0] * 3
for a in A:
	for i in range(2, -1, -1):
		if a % 2 ** i == 0:
			C[i] += 1
			break
print('Yes' * (C[0] <= C[2] or (C[0] == C[2] + 1 and C[1] == 0)) or 'No')


n = int(input())
a = list(map(int, input().split()))
b = list(map(lambda x: x % 4, a))
c1 = b.count(0)
c2 = b.count(2)
if c1 >= len(a) // 2:
	print('Yes')
elif c2 >= len(a) - 2 * c1:
	print('Yes')
else:
	print('No')


n = input()
data = list(map(int, input().split()))
a = [i for i in data if i % 4 == 0]
b = [i for i in data if i % 4 != 0]
c = [i for i in b if i % 2 == 0]
x = len(a) + len(c) // 2
y = len(b) - len(c) // 2
if y <= x + 1:
	print('Yes')
else:
	print('No')


import sys
n = int(input())
a = [int(x) for x in input().rstrip().split()]
even = 0
odd = 0
num4 = 0
for i in a:
	if i % 4 == 0:
		num4 += 1
		continue
	elif i % 2 == 0:
		even += 1
	else:
		odd += 1
if odd <= num4:
	print('Yes')
elif odd - 1 == num4 and even == 0:
	print('Yes')
elif odd == 0 and 2 <= even:
	print('Yes')
else:
	print('No')


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


import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
n_c4 = 0
n_c2 = 0
n_c0 = 0
for ai in a:
	if ai % 4 == 0:
		n_c4 += 1
	elif ai % 2 == 0:
		n_c2 += 1
	else:
		n_c0 += 1
if n_c4 >= n_c0 or (n_c4 == n_c0 - 1 and n_c4 + n_c0 == N):
	print('Yes')
else:
	print('No')


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


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


_ = input()
a = [int(x) for x in input().split()]
(odd, m4, m2) = (0, 0, 0)
for i in a:
	if i % 2 != 0:
		odd += 1
	elif i % 4 == 0:
		m4 += 1
	else:
		m2 = 1
else:
	if odd + m2 - 1 <= m4:
		print('Yes')
	else:
		print('No')


N = int(input())
a = list(map(int, input().split()))
f = 0
t = 0
for i in a:
	if i % 4 == 0:
		f += 1
	elif i % 2 == 0:
		t += 1
h = t // 2
s = (N - h * 2) // 2
s2 = N
if s <= f or s2 <= t:
	print('Yes')
else:
	print('No')


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


n = int(input())
(a, b) = (0, 0)
for x in input().split():
	x = int(x)
	if x % 4 == 0:
		a += 1
	elif x % 2 == 0:
		b += 1
if a * 2 + b // 2 * 2 + 1 >= n:
	print('Yes')
else:
	print('No')


N = int(input())
a = list(map(int, input().split()))
num2 = 0
num4 = 0
odd = 0
for i in a:
	if i % 4 == 0:
		num4 += 1
		continue
	elif i % 2 == 0:
		num2 += 1
		continue
	else:
		odd += 1
		continue
if odd <= num4 or (N % 2 == 1 and num4 == N // 2):
	print('Yes')
else:
	print('No')


n = int(input())
l = list(map(int, input().split()))
a1 = a2 = 0
for x in l:
	if x % 4 == 0:
		a1 += 1
	elif x % 2 == 0:
		a2 += 1
if a1 > 0:
	a1 -= 1
	n -= 3
	if a2 > 0:
		a2 -= 1
if a1 * 2 + a2 < n:
	print('No')
else:
	print('Yes')


N = int(input())
A = [int(x) for x in input().split()]
c0 = 0
c4 = 0
for a in A:
	if a % 2 == 1:
		c0 += 1
	elif a % 4 == 0:
		c4 += 1
if c0 <= c4:
	print('Yes')
elif c0 + c4 == N and c0 == c4 + 1:
	print('Yes')
else:
	print('No')


import math
N = int(input())
A = list(map(int, input().split()))
count = []
for i in A:
	if i % 4 == 0:
		count.append('4')
	elif i % 2 == 0:
		count.append('2')
	else:
		count.append('1')
B1 = count.count('4')
B2 = count.count('1')
if count.count('2') == 0:
	print('Yes' if B1 + 1 >= B2 else 'No')
else:
	print('Yes' if B1 >= B2 else 'No')


n = int(input())
a_list = [int(x) for x in input().split()]
x = y = z = 0
for a in a_list:
	if a % 4 == 0:
		x += 1
	elif a % 2 == 0:
		y += 1
	else:
		z += 1
print('Yes' if y == 0 and x >= z - 1 or (y > 0 and x >= z) else 'No')


N = int(input())
A = input().split()
v = [int(i) % 4 for i in A]
print('Yes' if v.count(0) + v.count(2) // 2 >= N // 2 else 'No')


(N, *A) = map(int, open(0).read().split())
l = [0] * 4
for a in A:
	l[a & 3] += 1
o = l[1] + l[3]
print('YNeos'[o > 1 + l[0] or (o - 1 == l[0] and l[2] > 0)::2])


n = int(input())
a = list(map(int, input().split()))
k = 0
g = 0
for i in a:
	if i % 4 == 0:
		g += 1
	if i % 2 == 1:
		k += 1
if g >= k or (g + 1 >= k and g + k == n):
	print('Yes')
else:
	print('No')


n = int(input())
a = map(int, input().split())
m = [0, 0, 0, 0]
for i in a:
	m[i % 4] += 1
m[1] += m[3]
if m[2] > 0:
	m[1] += 1
if m[0] < m[1] - 1:
	print('No')
else:
	print('Yes')


_ = input()
A = list(map(int, input().strip().split(' ')))
(a_4, a_2, a_1) = (0, 0, 0)
for a in A:
	if a % 4 == 0:
		a_4 += 1
	elif a % 2 == 0:
		a_2 = 1
	else:
		a_1 += 1
print('Yes' if a_4 + 1 >= a_1 + a_2 else 'No')


n = int(input())
lst1 = list(map(int, input().split()))
amount = 0
sub = 0
for i in lst1:
	if i % 4 == 0:
		amount += 1
	elif i % 2 == 0:
		sub += 1
if amount + sub // 2 >= len(lst1) // 2:
	print('Yes')
else:
	print('No')


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


N = int(input())
A = list(map(int, input().split()))
(p, q, r) = (0, 0, 0)
for a in A:
	if a % 4 == 0:
		p += 1
	elif a % 4 == 2:
		q = 1
	else:
		r += 1
print('Yes' if q + r <= p + 1 else 'No')


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


n = int(input())
a = list(map(int, input().split()))
bai4 = []
bai2 = []
bai_ = []
for ai in a:
	if ai % 4 == 0:
		bai4.append(ai)
	elif ai % 2 == 0:
		bai2.append(ai)
	else:
		bai_.append(ai)
len_bai_ = len(bai_)
len_bai2 = len(bai2)
len_bai4 = len(bai4)
if len_bai_ > len_bai4:
	if len_bai_ == len_bai4 + 1 and n == len_bai_ + len_bai4:
		print('Yes')
	else:
		print('No')
else:
	print('Yes')


n = int(input())
a = [int(i) for i in input().split()]
div2 = 0
div4 = 0
for i in a:
	if i % 4 == 0:
		div4 += 1
	elif i % 2 == 0:
		div2 += 1
if n - max(div2 - 1, 0) <= div4 * 2 + 1:
	print('Yes')
else:
	print('No')


(n, *l) = map(int, open(0).read().split())
o = t = f = 0
for i in l:
	if i % 4 == 0:
		f += 1
	elif i % 2 == 0:
		t += 1
	else:
		o += 1
print('YNeos'[(t > 0) + o > f + 1::2])


def main():
	n = int(input())
	As = list(map(int, input().split()))
	fours = 0
	evens = 0
	odds = 0
	for A in As:
		if A % 4 == 0:
			fours += 1
		elif A % 2 == 0:
			evens += 1
		else:
			odds += 1
	if fours + evens // 2 >= n // 2:
		ans = 'Yes'
	else:
		ans = 'No'
	print(ans)

def __starting_point():
	main()
__starting_point()


N = int(input())
A = list(map(int, input().split()))
B = [0, 0, 0]
for a in A:
	if a % 4 == 0:
		B[2] += 1
	elif a % 2 == 0:
		B[1] += 1
	else:
		B[0] += 1
print('Yes' if B[0] <= B[2] or (B[1] == 0 and B[0] - B[2] == 1) else 'No')


N = int(input())
oddCount = 0
mo4Count = 0
for i in map(int, input().split()):
	if i % 2 == 1:
		oddCount += 1
	elif i % 4 == 0:
		mo4Count += 1
if oddCount - N % 2 <= mo4Count:
	print('Yes')
else:
	print('No')


n = int(input())
a = [int(i) for i in input().split()]
c2 = 0
c4 = 0
c = 0
for i in a:
	if i % 4 == 0:
		c4 += 1
	elif i % 2 == 0:
		c2 += 1
	else:
		c += 1
if c == 0 or c + c2 - 1 <= c4 or c <= c4:
	print('Yes')
else:
	print('No')


N = int(input())
A = list(map(int, input().split()))
cnt = [0] * 3
for x in A:
	x %= 4
	if x == 0:
		cnt[2] += 1
	elif x == 2:
		cnt[1] += 1
	else:
		cnt[0] += 1
if cnt[0] <= cnt[2] or (cnt[1] == 0 and cnt[0] == cnt[2] + 1):
	print('Yes')
else:
	print('No')


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


n = int(input())
a = list(map(int, input().split()))
l = m = n = 0
for i in a:
	if i % 4 == 0:
		l += 1
	elif i % 2 == 0:
		m += 1
	else:
		n += 1
if l >= n or (m == 0 and l + 1 >= n):
	print('Yes')
else:
	print('No')


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


from collections import Counter
N = int(input())
b = [int(ai) % 4 for ai in input().split()]
c = Counter(b)
n1 = c[1] + c[3]
n2 = c[2]
n4 = c[0]
if (n2 == 0 or n1 <= n4) and (n2 != 0 or n1 <= n4 + 1):
	print('Yes')
else:
	print('No')


N = int(input())
ls = [int(s) for s in input().split()]
a0 = 0
a2 = 0
for n in ls:
	if n % 2 == 1:
		a0 += 1
	elif n % 4 == 0:
		a2 += 1
if a2 > a0 - 1:
	print('Yes')
elif a2 == a0 - 1:
	if a0 + a2 < N:
		print('No')
	else:
		print('Yes')
else:
	print('No')


n = int(input())
l = list(map(int, input().split()))
d = {0: 0, 1: 0, 2: 0, 3: 0}
for a in l:
	a = a % 4
	d[a] += 1
if d[1] + d[3] > d[0] + 1:
	print('No')
elif d[1] + d[3] == d[0] + 1 and d[2] > 0:
	print('No')
else:
	print('Yes')


N = int(input())
A = list(map(int, input().split()))
cntA = 0
cntB = 0
for i in range(N):
	if A[i] % 4 == 0:
		cntA += 1
	elif A[i] % 2 == 0:
		cntB += 1
print('Yes' if cntA + cntB // 2 >= N // 2 else 'No')


n1 = 0
n2 = 0
n4 = 0
nb = int(input())
for v in map(int, input().split()):
	if v % 4 == 0:
		n4 += 1
	elif v % 2 == 0:
		n2 += 1
	else:
		n1 += 1
if n1 <= n4 or (n1 == n4 + 1 and n2 == 0):
	print('Yes')
else:
	print('No')


N = int(input())
a = list(map(int, input().split()))
num2 = sum(map(lambda x: 1 if not x % 2 else 0, a))
num4 = sum(map(lambda x: 1 if not x % 4 else 0, a))
if N // 2 - num4 - (num2 - num4) // 2 <= 0:
	print('Yes')
else:
	print('No')


N = int(input())
A = list(map(int, input().split()))
sum = 0
cnt_two = 0
for i in range(N):
	if A[i] % 4 == 0:
		sum += 1
	elif A[i] % 2 == 0:
		cnt_two += 1
print('Yes' if sum + cnt_two // 2 >= N // 2 else 'No')


n = int(input())
A = list(map(int, input().split()))
(n2, n4) = (0, 0)
for a in A:
	if a % 4 == 0:
		n4 += 1
	elif a % 2 == 0:
		n2 += 1
if n2 != 0:
	n -= n2 - 1
print('Yes' if n4 >= n // 2 else 'No')


n = int(input())
a = [int(x) for x in input().split()]
res = 'No'

def check(p):
	if p % 4 == 0:
		return 2
	elif p % 2 == 0:
		return 1
	else:
		return 0
c0 = 0
c2 = 0
c4 = 0
for i in range(n):
	a[i] = check(a[i])
	if a[i] == 2:
		c4 += 1
	elif a[i] == 1:
		c2 += 1
	else:
		c0 += 1
if c0 == c4 + 1 and c2 == 0:
	res = 'Yes'
elif c0 <= c4:
	res = 'Yes'
print(res)


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 (n - max(0, cnt2 - 1)) // 2 <= cnt4:
	print('Yes')
else:
	print('No')


n = int(input())
l = [int(i) for i in input().split()]
s = 0
s1 = 0
for i in l:
	if i % 4 == 0:
		s += 1
	elif i % 2 == 0:
		s1 += 1
if s + s1 // 2 >= n // 2:
	print('Yes')
else:
	print('No')


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


import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '3\n1 10 100'
		output = 'Yes'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '4\n1 2 3 4'
		output = 'No'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = '3\n1 4 1'
		output = 'Yes'
		self.assertIO(input, output)

	def test_入力例_4(self):
		input = '2\n1 1'
		output = 'No'
		self.assertIO(input, output)

	def test_入力例_5(self):
		input = '6\n2 7 1 8 2 8'
		output = 'Yes'
		self.assertIO(input, output)

def resolve():
	N = int(input())
	A = list(map(int, input().split()))
	Q = 0
	E = 0
	O = 0
	for a in A:
		if a % 4 == 0:
			Q += 1
		elif a % 2 == 0:
			E += 1
		else:
			O += 1
	if N - 2 * Q <= 0 or N - 2 * Q == 1 or N - 2 * Q == E:
		print('Yes')
	else:
		print('No')

def __starting_point():
	resolve()
__starting_point()


N = int(input())
A = [int(a) for a in input().split()]
c4 = 0
c2 = 0
for a in A:
	if a % 4 == 0:
		c4 += 1
	elif a % 2 == 0:
		c2 += 1
if c4 >= N // 2:
	print('Yes')
elif c2 >= N - 2 * c4:
	print('Yes')
else:
	print('No')


N = int(input())
A = list(map(int, input().split()))
cnt_odd = 0
cnt_4 = 0
for a in A:
	if a % 2 != 0:
		cnt_odd += 1
	elif a % 4 == 0:
		cnt_4 += 1
if cnt_odd + cnt_4 == N and cnt_odd - 1 == cnt_4:
	print('Yes')
else:
	print('Yes' if cnt_4 >= cnt_odd else 'No')


n = int(input())
l = [int(i) for i in input().split()]
l_2 = [i for i in l if i % 2 == 0 and i % 4 != 0]
l_4 = [i for i in l if i % 4 == 0]
if len(l_2) // 2 + len(l_4) >= n // 2:
	print('Yes')
else:
	print('No')


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


n = int(input())
a = list(map(int, input().split()))
(cnt1, cnt2) = (0, 0)
for i in a:
	if i % 2 != 0:
		cnt1 += 1
	if i % 4 == 0:
		cnt2 += 1
print('Yes' if cnt2 >= cnt1 or (len(a) % 2 != 0 and cnt2 + 1 >= cnt1) else 'No')


n = int(input())
a = list(map(int, input().split()))
li = [0, 0, 0]
for i in range(n):
	if a[i] % 4 == 0:
		li[2] += 1
		continue
	elif a[i] % 2 == 0:
		li[1] += 1
	else:
		li[0] += 1
if li[0] == 0:
	print('Yes')
elif li[0] == 1:
	if li[2] >= 1:
		print('Yes')
	else:
		print('No')
else:
	k = li[0]
	if n >= 2 * k:
		if li[2] >= k:
			print('Yes')
		else:
			print('No')
	elif n == 2 * k - 1:
		if li[2] >= k - 1:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


from collections import deque
n = int(input())
A = list(map(int, input().split()))
cnt_2 = 0
cnt_4 = 0
for i in range(n):
	a = A[i]
	if a % 4 == 0:
		cnt_4 += 1
	elif a % 2 == 0:
		cnt_2 += 1
cnt_else = n - cnt_2 - cnt_4
cnt_else += cnt_2 % 2
if cnt_else - 1 <= cnt_4:
	print('Yes')
else:
	print('No')


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


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


input()
a = [int(i) for i in input().split()]
c = [i for i in a if i % 4 != 2]
if len(c) != len(a):
	c.append(1)
if len([i for i in c if i % 4 != 0]) - 1 <= len([i for i in c if i % 4 == 0]):
	print('Yes')
else:
	print('No')


n = int(input())
(x2, x4, x) = (0, 0, 0)
for num in input().split(' '):
	tmp = int(num)
	x2 += tmp % 2 == 0 and tmp % 4 != 0
	x4 += tmp % 4 == 0
	x += tmp % 2 != 0
print('Yes' if x + (x2 != 0) <= x4 + 1 else 'No')


N = int(input())
lsa = list(map(int, input().split()))
ans = 'Yes'
i4 = 0
i2 = 0
i1 = 0
for i in range(N):
	if lsa[i] % 4 == 0:
		i4 += 1
	elif lsa[i] % 2 == 0:
		i2 += 1
	else:
		i1 += 1
if i4 + 1 < i1:
	ans = 'No'
elif i2 % 2 == 1 and i4 + 1 == i1:
	ans = 'No'
print(ans)


N = int(input())
A = list(map(int, input().split()))
OD = 0
EV4 = 0
for i in A:
	if i % 2 == 1:
		OD += 1
	elif i % 4 == 0:
		EV4 += 1
EV = N - OD - EV4
ret = 'No'
if EV4 >= OD:
	ret = 'Yes'
elif EV4 == OD - 1 and EV == 0:
	ret = 'Yes'
print(ret)


N = int(input())
odd_count = 0
mo4_count = 0
for i in map(int, input().split()):
	if i % 2 == 1:
		odd_count += 1
	elif i % 4 == 0:
		mo4_count += 1
if odd_count - N % 2 <= mo4_count:
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
s = 0
t = 0
u = 0
for i in range(n):
	if a[i] % 4 == 0:
		s = s + 1
	elif a[i] % 2 == 0:
		t = t + 1
	else:
		u = u + 1
if t >= 1:
	if s >= u:
		print('Yes')
	else:
		print('No')
elif s - u >= -1:
	print('Yes')
else:
	print('No')


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


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


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


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


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


N = int(input())
src = list(map(int, input().split()))
one = sum([1 for a in src if a % 2])
four = sum([1 for a in src if a % 4 == 0])
two = N - one - four
print('Yes' if one <= four or (one == four + 1 and two == 0) else 'No')


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


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


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


N = int(input())
(s, t, u) = (0, 0, 0)
for i in list(map(int, input().split())):
	if i % 4 == 0:
		s += 1
	elif i % 2 == 0:
		t += 1
	else:
		u += 1
if u - s <= 1 and (t == 0 or u - s < 1):
	print('Yes')
else:
	print('No')


N = int(input())
A = [int(a) for a in input().split(' ')]
m_2_but_4 = 0
m_4 = 0
m_none = 0
for i in range(len(A)):
	if A[i] % 4 == 0:
		m_4 += 1
	elif A[i] % 2 == 0:
		m_2_but_4 += 1
	else:
		m_none += 1
if m_2_but_4:
	print('Yes') if m_4 >= m_none else print('No')
else:
	print('Yes') if m_4 + 1 >= m_none else print('No')


n = int(input())
an = [int(num) for num in input().split()]
(one, two, four) = (0, 0, 0)
for a in an:
	if a % 4 == 0:
		four += 1
	elif a % 2 == 0:
		two += 1
	else:
		one += 1
if two == 0 and four >= one - 1:
	print('Yes')
elif four >= one:
	print('Yes')
else:
	print('No')


n = int(input())
A = list(map(int, input().split()))
(cnt1, cnt2, cnt3) = (0, 0, 0)
for a in A:
	if a % 4 == 0:
		cnt1 += 1
	elif a % 2 == 0:
		cnt2 += 1
cnt1 += cnt2 // 2
print('Yes') if cnt1 >= n // 2 else print('No')


from collections import defaultdict
d = defaultdict(int)
d = [0] * 3
n = int(input())
for i in list(map(int, input().split())):
	if i % 4 == 0:
		d[2] += 1
	elif i % 2 == 0:
		d[1] += 1
	else:
		d[0] += 1
t = d[2] - d[1]
if d[0] <= d[2] or (d[0] == d[2] + 1 and d[1] == 0):
	print('Yes')
else:
	print('No')


n = int(input())
la = list(map(int, input().split()))
lc = [0] * n
for i in range(n):
	t = la[i]
	while t % 2 < 1 and lc[i] < 2:
		t //= 2
		lc[i] += 1
c = [lc.count(i) for i in range(3)]
print('YNeos'[c[0] - c[2] > 1 or (c[0] > c[2] and n % 2 < 1)::2])


N = int(input())
d4 = 0
d2 = 0
for i in list(map(int, input().split())):
	if i % 4 == 0:
		d4 += 1
	elif i % 2 == 0:
		d2 += 1
	else:
		None
if N <= d4 * 2 + 1:
	print('Yes')
elif N - d4 * 2 <= d2:
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
x = 0
y = 0
for i in a:
	if i % 4 == 2:
		y += 0.5
	elif i % 4 == 0:
		x += 1
if x + int(y) >= (n - 1) / 2:
	print('Yes')
else:
	print('No')


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


def even(x):
	flag1 = False
	if x % 2 == 0:
		flag1 = True
	return flag1

def multiple_of_4(x):
	flag2 = False
	if x % 2 == 0:
		x //= 2
		if x % 2 == 0:
			flag2 = True
	return flag2

def main():
	n = int(input())
	a_lst = list(map(int, input().split()))
	flag = False
	multiple_of_4_count = 0
	for i in range(n):
		if multiple_of_4(a_lst[i]):
			multiple_of_4_count += 1
	if multiple_of_4_count >= n // 2:
		flag = True
	else:
		even_count = 0
		for i in range(n):
			if even(a_lst[i]):
				even_count += 1
		tmp = n - 2 * multiple_of_4_count
		even_count -= multiple_of_4_count
		if even_count >= tmp:
			flag = True
	if flag:
		print('Yes')
	else:
		print('No')

def __starting_point():
	main()
__starting_point()


n = int(input())
A = list(map(int, input().split()))
ans = 'No'
c1 = c2 = c4 = 0
for a in A:
	if a % 4 == 0:
		c4 += 1
	elif a % 2 == 0:
		c2 += 1
	else:
		c1 += 1
if c4 == 0 and c1 > 0:
	ans = 'No'
elif c1 <= c4 + (c2 == 0):
	ans = 'Yes'
else:
	ans = 'No'
print(ans)


(n, *l) = map(int, open(0).read().split())
d = {1: 0, 2: 0, 4: 0}
for i in l:
	if i % 2:
		d[1] += 1
	elif i % 4:
		d[2] += 1
	else:
		d[4] += 1
if d[2]:
	print('YNeos'[d[1] > d[4]::2])
else:
	print('YNeos'[d[1] - 1 > d[4]::2])


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


n = int(input())
a = list(map(int, input().split()))
c2 = 0
c4 = 0
for aa in a:
	if aa % 2 == 0:
		if aa % 4 == 0:
			c4 += 1
		else:
			c2 += 1
c0 = n - (c2 + c4)
cc = c4 - c0
if c2 >= 1 and c2 != n:
	cc -= 1
print('Yes' if cc >= -1 else 'No')


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


N = int(input())
A = list(map(int, input().split()))
(other, two, four) = (0, 0, 0)
for a in A:
	if a % 4 == 0:
		four += 1
	elif a % 2 == 0:
		two += 1
	else:
		other += 1
ans = 'No'
if other <= four:
	ans = 'Yes'
elif other - four == 1 and two == 0:
	ans = 'Yes'
print(ans)


n = int(input())
(*a,) = map(int, input().split())
(*b,) = filter(lambda x: x % 4 != 0, a)
mul_4 = n - len(b)
(*c,) = filter(lambda x: x % 2 != 0, b)
mul_2 = (len(b) - len(c)) // 2
print('Yes' if n // 2 <= mul_4 + mul_2 else 'No')


a = int(input())
an = [int(i) for i in input().split()]
count = 0
for i in an:
	if i % 2 == 0:
		count += 1
	if i % 4 == 0:
		count += 1
if a % 2 == 1:
	a -= 1
if count >= a:
	print('Yes')
else:
	print('No')


N = int(input())
a = list(map(int, input().split()))
x = 0
y = 0
for ai in a:
	if ai % 4 == 0:
		x += 1
	elif ai % 2 == 1:
		y += 1
if x >= y or (x == y - 1 and x + y == N):
	print('Yes')
else:
	print('No')


N = int(input())
a = [int(i) for i in input().split()]
c = 0
c2 = 0
for n in a:
	if n % 4 == 0:
		c += 1
	elif n % 4 == 2:
		c2 += 1
ans = 'No'
if c >= N // 2:
	ans = 'Yes'
if N - c * 2 <= c2:
	ans = 'Yes'
print(ans)


from collections import Counter
N = int(input())
points = list(map(int, input().split()))
points = list(map(lambda i: i % 4, points))
l = Counter(points)
if l[0] + int(l[2] / 2) >= int(N / 2):
	print('Yes')
else:
	print('No')


(n, a) = (int(input()), [int(x) % 4 for x in input().split()])
print('Yes' if n // 2 <= a.count(0) + a.count(2) // 2 else 'No')


input()
a = list(map(int, input().split()))
l = [1 if i % 2 == 1 else 4 if i % 4 == 0 else 2 for i in a]
print('YNeos'[2 in l and l.count(1) > l.count(4) or (2 not in l and l.count(1) > l.count(4) + 1)::2])


N = int(input())
an = list(map(int, input().split()))
four = 0
odd = 0
for a in an:
	if a % 2 == 1:
		odd += 1
	elif a % 4 == 0:
		four += 1
print('Yes' if odd <= four or (N // 2 == four and -(-N // 2) == odd) else 'No')


N = int(input())
a = list(map(int, input().split()))
k0 = k1 = k2 = 0
for ai in a:
	if ai % 4 == 0:
		k2 += 1
	elif ai % 2 == 0:
		k1 += 1
	else:
		k0 += 1
if k1 == 0:
	f = k2 * 2 + 1 >= N
else:
	f = k2 * 2 + k1 >= N
print('Yes' if f else 'No')


(n, *l) = map(int, open(0).read().split())
o = t = 0
for i in l:
	o += i % 2
	t += i % 4 > 0
print('YNeos'[o > n - t + (t == o)::2])


n = int(input())
a = map(int, input().split())
flag = -1
odd = 0
m4 = 0
for i in a:
	if i % 4 == 0:
		m4 += 1
	elif i % 2 == 0:
		flag = 0
	else:
		odd += 1
print('Yes' if m4 >= odd + flag else 'No')


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


n = input()
I = [int(x) for x in input().split()]
(d1, d2, d4) = (0, 0, 0)
for i in I:
	if i % 4 == 0:
		d4 += 1
	elif i % 2 == 0:
		d2 += 1
	else:
		d1 += 1
if d2 > 0:
	d1 += 1
if d4 + 1 >= d1:
	print('Yes')
else:
	print('No')


import os
import sys

def main():
	n = int(input())
	A = list(map(int, input().split()))
	A_4 = [x for x in A if x % 4 == 0]
	A_2 = [x for x in A if x % 4 != 0 and x % 2 == 0]
	A_0 = [x for x in A if x % 2 != 0]
	if len(A_2) == 0 and len(A_0) <= len(A_4) + 1:
		print('Yes')
	elif len(A_0) <= len(A_4):
		print('Yes')
	else:
		print('No')

def __starting_point():
	main()
__starting_point()


n = int(input())
al = list(map(int, input().split()))
count2 = 0
count4 = 0
for a in al:
	if a % 4 == 0:
		count4 += 1
	elif a % 2 == 0:
		count2 += 1
v = count2 // 2
n -= v * 2
if count4 >= n // 2:
	ans = 'Yes'
else:
	ans = 'No'
print(ans)


import collections
_ = input()
A = collections.Counter((int(T) for T in input().split())).most_common()
Num4 = sum((A[T][1] for T in range(0, len(A)) if A[T][0] % 4 == 0))
Num2 = sum((A[T][1] for T in range(0, len(A)) if A[T][0] % 4 != 0 and A[T][0] % 2 == 0))
Odd = sum((A[T][1] for T in range(0, len(A)) if A[T][0] % 2 != 0))
if Num2 > 0:
	Capacity = Num4
else:
	Capacity = Num4 + 1
if Capacity >= Odd:
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
c_ki = 0
c_4 = 0
c_2 = 0
for i in range(n):
	if a[i] % 2 == 1:
		c_ki += 1
	elif a[i] % 4 == 0:
		c_4 += 1
	else:
		c_2 += 1
if c_ki <= c_4:
	print('Yes')
elif c_ki - 1 == c_4 and c_2 == 0:
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
n2 = 0
n4 = 0
for ai in a:
	if ai % 4 == 2:
		n2 += 1
	if ai % 4 == 0:
		n4 += 1
if n2 == 0 and n4:
	n2 += 1
if n2 + n4 * 2 >= n:
	print('Yes')
else:
	print('No')