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



Sample input:
3
1 10 100


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
n = int(input())
#a(i)とa(i+1)について、
#(1)二つとも偶数
#一つが4の倍数
#1,4,3,4,2,2,4,5
#2の個数はなんでも良いが、4でそのまとまりを挟む必要がある
#端に2をおけばあまり困らない
count4 = 0
count2 = 0
count_odd = 0
num_list = list(map(int, input().split()))
for i in num_list:
    if i % 4 == 0:
        count4 += 1
    elif i % 4 == 2:
        count2 += 1
    if i % 2 == 1:
        count_odd += 1
if count2 >= 1:
    real_count2 = 1
else:
    real_count2 = 0    
if count_odd == 0:
    print("Yes")
if  count_odd != 0 and count4 >= count_odd + real_count2 - 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
#a(i)とa(i+1)について、
#(1)二つとも偶数
#一つが4の倍数
#1,4,3,4,2,2,4,5
#2の個数はなんでも良いが、4でそのまとまりを挟む必要がある
#端に2をおけばあまり困らない
count4 = 0
count2 = 0
count_odd = 0
num_list = list(map(int, input().split()))
for i in num_list:
    if i % 4 == 0:
        count4 += 1
    elif i % 4 == 2:
        count2 += 1
    if i % 2 == 1:
        count_odd += 1
if count2 >= 1:
    real_count2 = 1
else:
    real_count2 = 0    
if count_odd == 0:
    print("Yes")
if  count_odd != 0 and count4 >= count_odd + count2 - 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
#a(i)とa(i+1)について、
#(1)二つとも偶数
#一つが4の倍数
#1,4,3,4,2,2,4,5
#2の個数はなんでも良いが、4でそのまとまりを挟む必要がある
count4 = 0
count2 = 0
count_odd = 0
num_list = list(map(int, input().split()))
for i in num_list:
    if i % 4 == 0:
        count4 += 1
    elif i % 4 == 2:
        count2 = 1
    if i % 2 == 1:
        count_odd += 1
if count_odd == 0:
    print("Yes")
if  count_odd != 0 and count4 >= count_odd + count2 - 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
#a(i)とa(i+1)について、
#(1)二つとも偶数
#一つが4の倍数
#1,4,3,4,2,2,4,5
#2の個数はなんでも良いが、4でそのまとまりを挟む必要がある
count4 = 0
count2 = 0
count_odd = 0
num_list = list(map(int, input().split()))
for i in num_list:
    if i % 4 == 0:
        count4 += 1
    elif i % 4 == 2:
        count2 = 1
    if i % 2 == 1:
        count_odd += 1
if count4 == 0:
    if count_odd == 0:
        print("Yes")
    else:
        print("No")    
if count4 >= count_odd +count2 - 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
#a(i)とa(i+1)について、
#(1)二つとも偶数
#一つが4の倍数
#1,4,3,4,2,2,4,5
#2の個数はなんでも良いが、4でそのまとまりを挟む必要がある
count4 = 0
count2 = 0
count_odd = 0
num_list = list(map(int, input().split()))
for i in num_list:
    if i % 4 == 0:
        count4 += 1
    elif i % 4 == 2:
        count2 = 1
    if i % 2 == 1:
        count_odd += 1
if count4 == 0:
    if count2 == 2 and count_odd == 0:
        print("Yes")
    else:
        print("No")    
if count4 >= count_odd +count2 - 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = list(map(int,input().split()))
zero = 0
one  = 0
two_or_more = 0

for a in a_list:
    remain = a%2
    if remain == 0:
        if a/2 >= 2:
            two_or_more += 1
        elif a/2 == 1:
            one += 1
    else:
        zero += 1

if one:
    zero += 1

if zero <= two_or_more or zero <= two_or_more+1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = list(map(int,input().split()))
zero = 0
one  = 0
two = 0

for a in a_list:
    remain = a%2
    if remain == 0:
        if a/2 >= 2:
            two += 1
        elif a/2 == 1:
            one += 1
    else:
        zero += 1

if one:
    zero += 1

if zero <= two+1 or zero <= two:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = list(map(int,input().split()))
zero = 0
one  = 0
two = 0

for a in a_list:
    remain = a%2
    if remain == 0:
        if a/2 >= 2:
            two += 1
        elif a/2 == 1:
            one += 1
    else:
        zero += 1

if one:
    zero += 1

if zero <= two+1 or zero <= two:
    print('yes')
else:
    print('no')

Submission status: Wrong Answer

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

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

if 0 < d < n:
    d -= 1

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

Submission status: Wrong Answer

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

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

if 0 < d < n:
    d -= 1

n -= f * 3 + d

if n > 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

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

d -= 1

n -= f * 3 + d

if n > 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

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

d -= d % 2

n -= f * 3 + d

if n > 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

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

if d == 1:
    d = 0

n -= f * 3 + d

if n > 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input().rstrip())

t = list(map(int, input().rstrip().split()))
h = (int)(len(t) / 2)

result = 'No'
num = 0
by2 = 0
for v in t:
    if (v % 4) == 0:
        num += 1
    elif v == 2:
        by2 += 1

    if h <= (num + int(by2 / 2)):
        result = 'Yes'
        break


print(result)

Submission status: Wrong Answer

Solution code:
def 解():
    iN = int(input())
    m4,m2,m1 = 0,0,0

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

Submission status: Wrong Answer

Solution code:
import collections

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


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

a = list(map(per4_2,a))


a_c=collections.Counter(a)

if a_c[4] >=2:
	if a_c[4] >= a_c[1]:
		print('Yes')
	else:
		print('No')
elif a_c[4] == 1 and a_c[2] == 0:
	if a_c[1] <=2:
		print('Yes')
	else:
		print('No')
elif a_c[4] == 1 and a_c[2] > 0:
	if a_c[1] <=1:
		print('Yes')
	else:
		print('No')
elif a_c[4] ==0:
	if a_c[1] ==0:
		print('Yes')
	else:
		print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))

nodd = 0
neven = 0
n4 = 0

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

res = 'No'

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

print(res)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))

nodd = 0
neven = 0
n4 = 0

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

res = 'No'

if n4*2 >= (nodd+neven%2):
  res = 'Yes'
elif nodd==0:
  res = 'Yes'

print(res)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))

nodd = 0
neven = 0
n4 = 0

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

res = 'No'

if n4*2 >= (nodd+neven%2):
  res = 'Yes'

print(res)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
A1=0
A2=0
A4=0

for i in range(N):
    if A[i]%4==0:
        A4+=1
    elif A[i]%2==0:
        A2+=1
    else:
        A1+=1
        
if A1>A4:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
A1=0
A2=0
A4=0

for i in range(N):
    if A[i]%4==0:
        A4+=1
    elif A[i]%2==0:
        A2+=1
    else:
        A1+=1
        
if A1+1>A4:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

a1 = []
a2 = []
a4 = []

for i in A:
    if i // 2 == 0 or i % 2 == 1:
        a1.append(i)
    elif i // 2 == 1 and i % 2 == 0:
        a2.append(i)
    else:
        a4.append(i)

b1 = len(a1)
b2 = len(a2)
b4 = len(a4)

if a2 == []:
    if b1 <= b4 + 1:
        print("Yes")
    else:
        print("No")

else:
    if b1 <= b4:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a1 = []
a2 = []
a4 = []

for i in A:
    if i // 2 == 0 or i % 2 != 0:
        a1.append(i)
    elif i // 2 == 1:
        a2.append(i)
    else:
        a4.append(i)

b1 = len(a1)
b2 = len(a2)
b4 = len(a4)

if a2 == []:
    if b1 <= b4 + 1:
        print("Yes")
    else:
        print("No")

else:
    if b1 <= b4:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

c4=0
c2=0

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

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

Submission status: Wrong Answer

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

c4=0
c2=0

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

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

Submission status: Wrong Answer

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

c4=0
c2=0

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

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

Submission status: Wrong Answer

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

c4=0
c2=0

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

if c4==0:
    if all(a[i]%2==0 for i in range(n)):
       print('Yes')
elif n<=2*c4 + max(1,c2):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

c4=0
c2=0

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

if c4==0:
    if all(a[i]%2==0 for i in range(n)):
       print('Yes')
elif n<=2*c4 + c2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

c4=0
c2=0

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

if c2==0:
    if n<=2*c4+1:
       print('Yes')
elif n<=2*c4 + c2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

c4=0
c2=0

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

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

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = list(li())

mod2 = 0
odd = 0
mod0 = 0

for ai in a:
    if ai%4 == 0:
        mod0 += 1
    elif ai%2 == 0:
        mod2 = 1
    else:
        odd += 1
        
odd += mod2

if mod0 >= (odd-1) and mod0>0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
c1=0#なんでもない
c2=0#２の倍数
c4=0#４の倍数

for i in a:
    if i%4==0:
        c4+=1
    elif i%2==0:
        c2+=1
    else:
        c1+=1
if ((c1+1)<=c4 and (c2>=2 or c2==0)) or (c2==1 and c4>=c1):
    print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
c1=0#なんでもない
c2=0#２の倍数
c4=0#４の倍数

for i in a:
    if i%4==0:
        c4+=1
    elif i%2==0:
        c2+=1
    else:
        c1+=1
if ((c1-1)<=c4 and (c2>=2 or c2==0)) or (c2==1 and c4>=c1):
    print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
c1=0#なんでもない
c2=0#２の倍数
c4=0#４の倍数

for i in a:
    if i%4==0:
        c4+=1
    elif i%2==0:
        c2+=1
    else:
        c1+=1
if (c1-1)<=c4 and (c2>=2 or c2==0):
    print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:

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

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


    if n//2 <= four:
        print("Yes")
    elif n//2 - four == 1:
        if n %2 ==0:
            if two >= 2:
                print("Yes")
                exit()
        else:
            if two >= 4:
                print("Yes")
                exit()

        print("No")


if __name__ == "__main__":
        main()

Submission status: Wrong Answer

Solution code:
N = int(input())
n_four, n_two, n_other = 0, 0, 0
for ai in map(int, input().split()):
    if ai % 4 == 0:
        n_four += 1
    elif ai % 2 == 0:
        n_two += 1
    else:
        n_other += 1


if n_four + 1 >= n_other:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a_list = list(map(int, input().split()))

multi4 = len([a for a in a_list if a % 4 == 0])
odd_num = len([a for a in a_list if a % 2 != 0])

even_num = len(a_list) - odd_num
not4 = even_num - multi4

if odd_num <= multi4+1:
    if odd_num <= multi4:
        print("Yes")
    else:
        print("No")

else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a_list = list(map(int, input().split()))

multi4 = len([a for a in a_list if a % 4 == 0])
odd_num = len([a for a in a_list if a % 2 != 0])

even_num = len(a_list) - odd_num
not4 = even_num - multi4

if odd_num <= multi4+1:
    if not4 >= 2 and not4 % 2 == 0:
        print("Yes")
    elif not4 == 0:
        print("Yes")
    elif not4 == 1:
        print("No")
    else :
        print("No")

else:
    print("No")

Submission status: Wrong Answer

Solution code:

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

multi4 = len([a for a in a_list if a % 4 == 0])
odd_num = len([a for a in a_list if a % 2 != 0])

even_num = len(a_list) - odd_num
not4 = even_num - multi4

if odd_num <= multi4+1:
    if not4 == 1:
        print("No")
    elif not4 == 0:
        print("Yes")
    elif not4 >= 1 and not4 % 2 == 0:
        print("Yes")
    else :
        print("No")

else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a_list = list(map(int, input().split()))

multi4 = len([a for a in a_list if a % 4 == 0])
odd_num = len([a for a in a_list if a % 2 != 0])

even_num = len(a_list) - odd_num
not4 = even_num - multi4

if odd_num <= multi4:
    if not4 >= 1:
        if not4 % 2 == 0:
            print("Yes")
        else:
            print("No")
    else:
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

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

nl = [0] * 3

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

# 2は2個以上あればとりあえず全部繋げとけば良い、1個だけなら１と同じ
if nl[1] == 1:
  nl[0] += 1

# 2が2個以上あれば、2.....2,4,1,4,1の形を満たせばOK
# ２が0個なら、1,4,1,4,...4,1の形を満たせばOK
if nl[1] >= 2 and nl[2] >= nl[0]:
  print("Yes")
elif nl[1] == 0 and nl[2] >= nl[0] - 1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

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

nl = [0] * 3

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

# 2は2個以上あれば全部繋げとけば良い、1個だけなら１と同じ
if nl[1] == 1:
  nl[0] += 1

# 1,4,1,4,1の形を満たせばOK
if nl[2] >= nl[0] - 1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
b = int(input())

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

co = 0
s = 0
ss = 0

for i in range(len(a)):
  while a[i] % 2 == 0:
    co += 1
    a[i] //= 2
  co = 0
  if co == 1:
    s += 1
  elif co >= 2:
    ss += 1
  
b -= s

if b % 2 == 1 and s > 0:
  b += 1
elif b % 2 == 1 and s == 0:
  b -= 1
b //= 2

if ss >= b:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
b = int(input())

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

co = 0
s = 0
ss = 0

for i in range(len(a)):
  while a[i] % 2 == 0:
    co += 1
    a[i] //= 2
  if co == 1:
    s += 1
  elif co >= 2:
    ss += 1
  
b -= s

if b % 2 == 1 and s > 0:
  b += 1
elif b % 2 == 1 and s == 0:
  b -= 1
b //= 2

if ss >= b:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
b = int(input())

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

co = 0
s = 0
ss = 0

for i in range(len(a)):
  while a[i] % 2 == 0:
    co += 1
    a[i] //= 2
  if co == 1:
    s += 1
  elif co >= 2:
    ss += 1
  
b -= s

if b % 2 == 1:
  b += 1
b //= 2

if ss >= b:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

than_2, than_1, than_0 = 0, 0, 0 
for a_i in a:
	if a_i%4 == 0:
		than_2 += 1
	elif a_i%2 == 0:
		than_1 += 1
	else:
		than_0 += 1

if n <= than_2*2 + than_1:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
def count_two(n):
	count = 0
	while n%2 == 0:
		n //= 2
		count += 1
	return count

n = int(input())
a = tuple(map(int, input().split(" ")))

than_2, than_1, than_0 = 0, 0, 0 
for a_i in a:
	count_two_a_i = count_two(a_i)
	if 2 <= count_two_a_i:
		than_2 += 1
	elif 1 <= count_two_a_i:
		than_1 += 1
	else:
		than_0 += 1

if than_0 + bool(than_1==1) <= than_2*2:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
def count_two(n):
	count = 0
	while n%2 == 0:
		n //= 2
		count += 1
	return count

n = int(input())
a = tuple(map(int, input().split(" ")))

than_2, than_1, than_0 = 0, 0, 0 
for a_i in a:
	count_two_a_i = count_two(a_i)
	if 2 <= count_two_a_i:
		than_2 += 1
	elif 1 <= count_two_a_i:
		than_1 += 1
	else:
		than_0 += 1

if (than_0 + bool(than_1==1)) / 2 <= than_2:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
def count_two(n):
	count = 0
	while n%2 == 0:
		n //= 2
		count += 1
	return count

n = int(input())
a = tuple(map(int, input().split(" ")))

than_2, than_1, than_0 = 0, 0, 0 
for a_i in a:
	count_two_a_i = count_two(a_i)
	if 2 <= count_two_a_i:
		than_2 += 1
	elif 1 <= count_two_a_i:
		than_1 += 1
	else:
		than_0 += 1

if than_0 <= than_2*2 - bool(than_1==1):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
def count_two(n):
	count = 0
	while n%2 == 0:
		n //= 2
		count += 1
	return count

n = int(input())
a = tuple(map(int, input().split(" ")))

a_count_two = [2 <= count_two(a_i) for a_i in a]
if a_count_two.count(0)*2 <= sum(a_count_two) and 1 <= sum(a_count_two):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
def count_two(n):
	count = 0
	while n%2 == 0:
		n //= 2
		count += 1
	return count

n = int(input())
a = tuple(map(int, input().split(" ")))

a_count_two = [min(count_two(a_i), 6) for a_i in a]
if a_count_two.count(0)*2 <= sum(a_count_two) and 1 <= sum(a_count_two):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
def count_two(n):
	count = 0
	while n%2 == 0:
		n //= 2
		count += 1
	return count

n = int(input())
a = tuple(map(int, input().split(" ")))

a_count_two = [min(count_two(a_i), 5) for a_i in a]
if a_count_two.count(0)*2 <= sum(a_count_two) and 1 <= sum(a_count_two):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
def hoge(i):
    if i % 4 == 0:
        return 4
    elif i % 2 == 0:
        return 2
    else:
        return 0
a = list(map(hoge, a))
print(a)
if sum(a) >= (n*2 if n%2 == 0 else (n-1)*2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

# all 2 then ok 
# if a == [2 for x in range(N)] :
#     print("Yes")
    
# else count numbers divisable by four
#else :
div4 = 0
is2 = 0
    
for i in a :
    if i == 2 :
        is2 += 1
    elif i % 4 == 0 :
        div4 += 1
            
if len(a) % 2 == 0 :
    if div4 + is2 // 2 >= N / 2 :
        print("Yes")
    else :
        print("No")
else :
    if div4 + is2 // 2 >= (N - 1) / 2 :
        print("Yes")
    else :
        print("No")

Submission status: Wrong Answer

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

# all 2 then ok 
if a == [2 for x in range(N)] :
    print("Yes")
    
# else count numbers divisable by four
else :
    div4 = 0
    is2 = 0
    
    for i in a :
        if i == 2 :
            is2 += 1
        elif i % 4 == 0 :
            div4 += 1
            
    if len(a) % 2 == 0 :
        if div4 + is2 // 2 >= N / 2 :
            print("Yes")
        else :
            print("No")
    else :
        if div4 + is2 // 2 >= (N - 1) / 2 :
            print("Yes")
        else :
            print("No")

Submission status: Wrong Answer

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

# all 2 then ok 
if a == [2 for x in range(N)] :
    print("Yes")
    
# else count numbers divisable by four
else :
    div4 = 0
    is2 = 0
    
    for i in a :
        if i == 2 :
            is2 += 1
        elif i % 4 == 0 :
            div4 += 1
            
    if len(a) % 2 == 0 :
        if div4 + is2 // 2 >= N // 2 :
            print("Yes")
        else :
            print("No")
    else :
        if div4 + is2 // 2 >= (N - 1) // 2 :
            print("Yes")
        else :
            print("No")

Submission status: Wrong Answer

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

# all 2 then ok 
if a == [2 for x in range(N)] :
    print("Yes")
    
# else count numbers divisable by four
else :
    div4 = 0
    is2 = 0
    
    for i in a :
        if i == 2 :
            is2 += 1
        elif i % 4 == 0 :
            div4 += 1
            
    if (is2 > 1 and div4 >= (N - is2 + 1) // 2) or (is2 < 2 and div4 >= N // 2) :
        print("Yes")
    else :
        print("No")

Submission status: Wrong Answer

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

# all 2 then ok 
if a == [2 for x in range(N)] :
    print("Yes")
# else count numbers divisable by four
else :
    div4 = 0
    is2 = 0
    
    for i in a :
        if i == 2 :
            is2 += 1
        elif i % 4 == 0 :
            div4 += 1
            
    if div4 >= (N - is2 // 2) // 2 :
        print("Yes")
    else :
        print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
count=0
for i in a:
  if i%4==0:
    count+=1

if len(a)%2 ==0:
    if a.count(2)//2+count >= len(a)/2:
    	print('Yes')
    else:
        print('No') 
else:
    if a.count(2)//2+count >= (len(a)-1)/2:
    	print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
s=list(map(int,input().split()))
a4=a2=0
for i in s:
    if i%4==0:a4+=1
    elif i%2==0:a2+=1
a0=n-a4-a2
print("No" if a0>a4 else "Yes")

Submission status: Wrong Answer

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

a, b, c = 0, 0, 0

for e in A:
    if e % 2 == 0:
        if e % 4 == 0:
            c += 1
        else:
            b += 1
    else:
        a += 1

print('Yes' if c - a - (b == 0) >= 0 else 'No')

Submission status: Wrong Answer

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

a, b, c = 0, 0, 0

for e in A:
    if e % 2 == 0:
        if e % 4 == 0:
            c += 1
        else:
            b += 1
    else:
        a += 1

print('Yes' if c >= a else 'No')

Submission status: Wrong Answer

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

a, b, c = 0, 0, 0

for e in A:
    if e % 2 == 0:
        if e % 4 == 0:
            c += 1
        else:
            b += 1
    else:
        a += 1

print('Yes' if c - (b == 1) - a >= 0 else 'No')

Submission status: Wrong Answer

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

a, b, c = 0, 0, 0

for e in A:
    if e % 2 == 0:
        if e % 4 == 0:
            c += 1
        else:
            b += 1
    else:
        a += 1

print('Yes' if c - a >= 0 else 'No')

Submission status: Wrong Answer

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

a, b, c = 0, 0, 0

for e in A:
    if e % 2 == 0:
        if e % 4 == 0:
            c += 1
        else:
            b += 1
    else:
        a += 1

print('Yes' if c * 2 + 1 - b % 2 - a >= 0 else 'No')

Submission status: Wrong Answer

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

a, b, c = 0, 0, 0

for e in A:
    if e % 2 == 0:
        if e % 4 == 0:
            c += 1
        else:
            b += 1
    else:
        a += 1

print('Yes' if c * 2 - b % 2 - a >= 0 else 'No')

Submission status: Wrong Answer

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

mod2 = []
mod4 = []

for i in range(N):
    mod2.append(A[i]%2 == 1)
    mod4.append(A[i]%4 == 0)
    

not4but2 = 0
for m2, m4 in zip(mod2, mod4):
    if m2==False and m4==False:
        not4but2 += 1
        
new_N = N - not4but2//2
odd = sum(mod2) + not4but2%2
even = new_N - odd


if new_N%2 == 0:
    if odd > (new_N/2):
        print("No")
    else:
        print("Yes")
        
else:
    if odd > (new_N+1)/2:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

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

if len(a) != 1 and len(set(a)) == 1 and set(a).pop() == 2 :
    print("Yes")
elif len(a) == 1 :
    if a[0] % 4 == 0 :
        print("Yes")
    else :
        print("No")
elif 0 in a :
    print("No")
else :
    four_need = N // 2
    four_cnt = 0
    two_cnt = 0
    for i in a :
        if i == 2 :
            two_cnt += 1
        if i % 4 == 0 :
            four_cnt += 1
            
    if four_cnt >= four_need - two_cnt // 2 :
        print("Yes")
    else :
        print("No")

Submission status: Wrong Answer

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

if len(a) != 1 and len(set(a)) == 1 and set(a).pop() == 2 :
    print("Yes")
elif len(a) == 1 :
    if a[0] % 4 == 0 :
        print("Yes")
    else :
        print("No")
else :
    four_need = N // 2
    four_cnt = 0
    two_cnt = 0
    for i in a :
        if i == 2 :
            two_cnt += 1
        if i % 4 == 0 :
            four_cnt += 1
            
    if four_cnt >= four_need - two_cnt // 2 :
        print("Yes")
    else :
        print("No")

Submission status: Wrong Answer

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

if len(set(a)) == 1 and set(a).pop() == 2 :
    print("Yes")
else :
    four_need = N // 2
    four_cnt = 0
    two_cnt = 0
    for i in a :
        if i == 2 :
            two_cnt += 1
        if i % 4 == 0 :
            four_cnt += 1
            
    if four_cnt >= four_need - two_cnt // 2 :
        print("Yes")
    else :
        print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

# okは4の倍数
ok = 0
# ngは4の倍数でもexcpでもない数
ng = 0
# excpはそのグループ内のペアに限って4の倍数になれる数
excp = 0
for i in range(N):
    if aN[i] % 4 == 0:
        ok += 1
    elif (aN[i] + 2) % 4 == 0:
        excp += 1
    else:
        ng += 1

# excpは2つでng1つ扱い
ng += excp // 2
ng += excp % 2

# 外をngで囲まれてもいいので、okが1個少なくてもyes
if ok + 1 >= ng:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

# okは4の倍数
ok = 0
# ngは4の倍数でもexcpでもない数
ng = 0
# excpはそのグループ内のペアに限って4の倍数になれる数
excp = 0
for i in range(N):
    if aN[i] % 4 == 0:
        ok += 1
    elif (aN[i] + 2) % 4 == 0:
        excp += 1
    else:
        ng += 1

# excpは2つでng1つ扱い
ng += excp // 2
ng += excp % 2

# 外をngで囲まれてもいいので、okが1個少なくてもyes
if ok + 1 >= ng:
    print("yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
li = [0,0,0]
for nums in A:
  if nums%4==0:
    li[0] += 1
  elif nums%2==0:
    li[1] += 1
  else:
    li[2] += 1
if li[1]==0 and li[2]-li[0]>1:
  print('No')
if li[1]!=0 and li[2]-li[0]>0:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

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

count = 0
for i in range(N):
    if a[i]%4 == 0:
        count += 1

if count >= N//2:
    print("Yes")
else:
    print("No")