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 = [int(_) for _ in input().split()]

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

print(c1, c2, c4)
if c1 > c4 + 1:
    print("No")
elif c1 == c4 + 1:
    if c2 == 0:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]

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

if c1 > c4 + 1:
    print("No")
elif c1 == c4 + 1:
    if c2 == 1:
        print("No")
    else:
        print("Yes")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]

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

if c1 > c4 + 1:
    print("No")
elif c1 == c4 + 1 or c1 + c4 == 0:
    if c2 == 1:
        print("No")
    else:
        print("Yes")
else:
    print("Yes")

Submission status: Wrong Answer

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

# 4の倍数, 4の倍数でない偶数, 奇数の数
i, j, k = 0, 0, 0

for n in range(N):
    if a[n] % 4 == 0:
        i += 1
    elif a[n] % 2 == 0:
        j += 1
    else:
        k += 1

print(i, j, k)

if k >= i + 2:
    print('No')
elif k == i + 1 and j >= 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = (input())
a = list(map(int, input().split()))
f_count = 0
t_count = 0
for i in range(len(a)):
    if a[i]%4 == 0:
        f_count += 3
    elif a[i]%2 == 0:
        t_count += 1
        
if (f_count >= len(a)) or ((f_count + t_count > len(a)) and ( t_count > 1)):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = (input())
a = list(map(int, input().split()))
f_count = 0
t_count = 0
for i in range(len(a)):
    if a[i]%4 == 0:
        f_count += 3
    elif a[i]%2 == 0:
        t_count += 1
        
if (f_count >= len(a)) or ((f_count + t_count >= len(a)) and ( t_count > 1)):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

for i in range(len(a)):
    if a[i]%4 == 0:
        count += 3
    elif a[i]%2 == 0:
        count += 1
        
if count >= len(a):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
input_list = [int(i) for i in input().split()]
four_count = 0
two_count = 0

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

others_count = N - four_count - two_count

if two_count:
    if others_count <= four_count + 1:
        print("Yes")
    else:
        print("No")
else:
    if others_count <= four_count:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
input_list = [int(i) for i in input().split()]
four_count = 0
two_count = 0

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

others_count = N - four_count - two_count

if two_count:
    if others_count <= four_count:
        print("Yes")
    else:
        print("No")
else:
    if others_count < four_count:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
input_list = [int(i) for i in input().split()]
four_count = 0
two_count = 0

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

const = N // 2

if const == four_count:
    print("Yes")
elif const > four_count:
    limit = (N - 2 * four_count - 1)
    if limit == 1:
        if two_count >= 2:
            print("Yes")
        else:
            print("No")
    else:
        if limit <= two_count:
            print("Yes")
        else:
            print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
# when input length is odd, n-1 / 2
# when input length is even, n / 2
# 6
# 2 7 1 8 2 8
# 1 8 7 8 2 2
# # # # # #
# 3個(len/2)４の倍数がYesを出力できる
# 4の倍数の個数がlen/2以下になるときその個数分*2個分２があれば、Yesを出力できる
N = int(input())
input_list = [int(i) for i in input().split()]
four_count = 0
two_count = 0

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

const = N // 2

if const > four_count:
    if const - four_count <= two_count:
        print("Yes")
    else:
        print("No")
elif const == four_count:
    print("Yes")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
# when input length is odd, n-1 / 2
# when input length is even, n / 2
# 6
# 2 7 1 8 2 8
# 1 8 7 8 2 2
# # # # # #
# 3個(len/2)４の倍数がYesを出力できる
# 4の倍数の個数がlen/2以下になるときその個数分*2個分２があれば、Yesを出力できる
N = int(input())
input_list = [int(i) for i in input().split()]
four_count = 0
two_count = 0

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

const = N // 2

if const > four_count:
    if const - four_count < two_count:
        print("Yes")
    else:
        print("No")
elif const == four_count:
    print("Yes")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
input_list = [int(i) for i in input().split()]
four_count = 0
two_count = 0

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

const = N // 2

if const > four_count:
    if const - four_count < two_count:
        print("Yes")
    else:
        print("No")
elif const == four_count:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list((input().split()))
for i in range (len(a)):
    if int(a[i])%4==0 and int(a[i])!=0:
            a[i]=2
    elif int(a[i])%2==0 and int(a[i])!=0:
            a[i]=1
    else:
            a[i]=0  
        
count=0
count+=a.count(2)*3

if count==0:
    count+=a.count(1)

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

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list((input().split()))
for i in range (len(a)):
    if int(a[i])%4==0 and int(a[i])!=0:
            a[i]=2
    elif int(a[i])%2==0 and int(a[i])!=0:
            a[i]=1
    else:
            a[i]=0  
        
count=0
count+=a.count(2)*3
if a.count(1)%2==0:
    count+=a.count(1)
else:
    count+=a.count(1)-1
if count>=len(a):
    print ("Yes")
else:
    print ("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list((input().split()))
for i in range (len(a)):
    if int(a[i])%4==0 and int(a[i])!=0:
            a[i]=2
    elif int(a[i])%2==0 and int(a[i])!=0:
            a[i]=1
    else:
            a[i]=0  
        
count=0
count+=a.count(2)*3
count+=a.count(1)
if count>=len(a):
    print ("Yes")
else:
    print ("No")

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin

n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))

n_2 = n
n_4 = n // 2
a_2 = 0
a_4 = 0

for i in a:
    if i % 4 == 0:
        a_4 += 1
        a_2 += 1
    elif i % 2 == 0:
        a_2 += 1

if a_4 >= n_4 or a_2 >= n_2 or a_2 >= (n-a_4*2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin

n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))

n_2 = n
n_4 = n // 2
a_2 = 0
a_4 = 0

for i in a:
    if i % 4 == 0:
        a_4 += 1
        a_2 += 1
    elif i % 2 == 0:
        a_2 += 1

if a_4 >= n_4 or a_2 >= n_2 or a_4 >= n_4-1 and a_2 >= 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def m():
    N = int(input())
    a = list(map(int, input().split()))
    fours = []
    twes = []
    others = []
    for i in range(N):
        if a[i] % 4 == 0:
            fours.append(a[i])
            continue

        if a[i] % 2 == 0:
            twes.append(a[i])
            continue
        others.append(a[i])

    len4s = len(fours)
    len2s = len(twes)
    others = len(others)
    if (others + len2s) <= len4s + 1:
        return 'Yes'
    if others <= len4s + 1:
        if len2s % 2 == 0:
            return 'Yes'
    if len4s == 0 and others ==0:
        if len2s % 2 == 0:
            return 'Yes'
    return 'No'


print(m())

Submission status: Wrong Answer

Solution code:
def m():
    N = int(input())
    a = list(map(int, input().split()))
    fours = []
    twes = []
    others = []
    for i in range(N):
        if a[i] % 4 == 0:
            fours.append(a[i])
            continue

        if a[i] % 2 == 0:
            twes.append(a[i])
            continue
        others.append(a[i])

    len4s = len(fours)
    len2s = len(twes)
    others = len(others)
    if (others + len2s) <= len4s + 1:
        return 'Yes'
    if others <= len4s + 1:
        if len2s % 2 == 0:
            return 'Yes'
    return 'No'


print(m())

Submission status: Wrong Answer

Solution code:
def m():
    N = int(input())
    a = list(map(int, input().split()))
    fours = []
    twes = []
    others = []
    for i in range(N):
        if a[i] % 4 == 0:
            fours.append(a[i])
            continue

        if a[i] % 2 == 0:
            twes.append(a[i])
            continue
        others.append(a[i])

    len4s = len(fours)
    len2s = len(twes)
    others = len(others)
    if (others + len2s) + 1 <= len4s:
        return 'Yes'
    if others + 1 <= len4s:
        if len2s % 2 == 0:
            return 'Yes'
    return 'No'

print(m())

Submission status: Wrong Answer

Solution code:
def m():
    N = int(input())
    a = list(map(int, input().split()))
    fours = []
    twes = []

    for i in range(N):
        if a[i] % 4 == 0:
            fours.append(a[i])
            continue

        if a[i] % 2 == 0:
            twes.append(a[i])

    if len(a) % 3 == 0:
        if ((len(a) + len(twes))// 3) <= len(fours):
                return 'Yes'
        if len(a) // 3 <= len(fours):
            if len(twes) % 2 == 0:
                return 'Yes'
    else:
        if ((len(a) + len(twes)) // 3) + 1 <= len(fours):
                return 'Yes'
        if (len(a) // 3) + 1 <= len(fours):
            if len(twes) % 2 == 0:
                return 'Yes'

    return 'No'

print(m())

Submission status: Wrong Answer

Solution code:
def m():
    N = int(input())
    a = list(map(int, input().split()))
    fours = []
    twes = []

    for i in range(N):
        if a[i] % 4 == 0:
            fours.append(a[i])
            continue

        if a[i] % 2 == 0:
            twes.append(a[i])

    if len(a) % 3 == 0:
        if (len(a) // 3) <= len(fours):
            if len(twes) % 2 == 0:
                return 'Yes'
    else:
        if (len(a) // 3) + 1 <= len(fours):
            if len(twes) % 2 == 0:
                return 'Yes'

    return 'No'

print(m())

Submission status: Wrong Answer

Solution code:
def m():
    N = int(input())
    a = list(map(int, input().split()))
    fours = []

    for i in range(N):
        if a[i] % 4 == 0:
            fours.append(a[i])
    if len(a) % 3 == 0:
        if (len(a) // 3) <= len(fours):
            return 'Yes'
    else:
        if (len(a) // 3) + 1 <= len(fours):
            return 'Yes'

    return 'No'

print(m())

Submission status: Wrong Answer

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

zero = 0
two = 0
odd = 0

for i in range(len(a)):
    if a[i] % 4 == 1 or a[i] % 4 == 3:
        odd = odd + 1
    elif a[i] % 4 == 0:
        zero = zero + 1
    else:
        two = two + 1
        
if zero >= odd -1 and two >= 2:
    print('Yes')
elif zero >= odd:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

zero = 0
two = 0
odd = 0

for i in range(len(a)):
    if a[i] % 4 == 1 or a[i] % 4 == 3:
        odd = odd + 1
    elif a[i] % 4 == 0:
        zero = zero + 1
    else:
        two = two + 1
        
if zero >= odd -1 or zero > odd:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

zero = 0
two = 0
odd = 0

for i in range(len(a)):
    if a[i] % 4 == 1 or a[i] % 4 == 3:
        odd = odd + 1
    elif a[i] % 4 == 0:
        zero = zero + 1
    else:
        two = two + 1
        
if zero == odd or zero > odd:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

zero = 0
two = 0
odd = 0

for i in range(len(a)):
    if a[i] % 4 == 1 or a[i] % 4 == 3:
        odd = odd + 1
    elif a[i] % 4 == 0:
        zero = zero + 1
    else:
        two = two + 1
        
if zero == odd:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
def judge(one, two, four):
	if one > four: return 'No'
	else: return 'Yes'	

N = int(raw_input())
a = map(int, raw_input().split())
one = 0
two = 0
four = 0

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

print judge(one, two, four)

Submission status: Wrong Answer

Solution code:
n=int(input());*a,=map(int,input().split());b=c=0
for x in a:
    if x%4==0:b+=1
    if x==2:c+=1
print(['No','Yes'][(n-c-(c>0))//2<=b])

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = sum([1 for i in a if i%4 == 0])
print("Yes" if len(a)//2 <= count else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = sum([1 for i in a if i%4 == 0])
print("Yes" if len(a)//2 == count else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
t=list(map(int,input().split()))
a=0
b=0
c=0
for i in range(n):
    if t[i]%4==0:#4の倍数
        a+=1
    elif t[i]%2==0 and t[i]%4!=0:#2の倍数かつ4の倍数でない
        b+=1
    else:
        c+=1
if b==0:
    if abs(c-a)<=1:
        print("Yes")
    else:
        print("No")
elif b!=0:
    if c<=a:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
t=list(map(int,input().split()))
a=0
b=0
c=0
for i in range(n):
    if t[i]%4==0:#4の倍数
        a+=1
    elif t[i]%2==0 and t[i]%4!=0:#2の倍数かつ4の倍数でない
        b+=1
    else:
        c+=1
if b==0:
    if c+1<=a:
        print("Yes")
    else:
        print("No")
elif b!=0:
    if c<=a:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
t=list(map(int,input().split()))
a=0
b=0
c=0
for i in range(n):
    if t[i]%4==0:#4の倍数
        a+=1
    elif t[i]%2==0 and t[i]%4!=0:#2の倍数かつ4の倍数でない
        b+=1
    else:
        c+=1
add=b+c
if abs(a-add)<=1:
    print("Yes")
elif c==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
t=list(map(int,input().split()))
a=0
b=0
c=0
for i in range(n):
    if t[i]%4==0:
        a+=1
    elif t[i]%2==0 and t[i]%2!=0:
        b+=1
    else:
        c+=1
add=b+c
if abs(a-add)<=1:
    print("Yes")
elif c==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

div4, div2 = 0, 0
for i in range(n):
    if a[i]%4 == 0:
        div4 += 1
    elif a[i]%2 == 0:
        div2 += 1

if div4+div2//2 >= n/3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

b_4 = 0
b_2 = 0
kisu = 0

for i in range(n):
    if a[i] % 4 ==1 or 3:
        kisu = kisu + 1
    elif a[i] % 2 == 2:
        b_2 = b_2 + 1
    else:
        b_4 = b_4 + 1
        
if b_2 == 0 and kisu - b_4 < 2:
    print('Yes')
elif b_2 > 1 and kisu - b_4 <1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

b_4 = 0
b_2 = 0
kisu = 0

for i in range(n):
    if a[i] % 4 ==1 or 3:
        kisu = kisu + 1
    elif a[i] % 2 == 2:
        b_2 = b_2 + 1
    else:
        b_4 = b_4 + 1
        
if b_2 == 0 and kisu - b_4 < 2:
    print('Yes')
elif b_2 > 1 and b_4 - kisu <2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
odd,n4 = 0,0
for i in range(N):
    if A[i]%2 == 1:
        odd += 1
    else:
        if A[i]%4 == 0:
            n4 += 1
if N==3 and n4>0:
    print("Yes")
else:
    print("Yes" if n4 >= odd else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=input().split(" ")
num=0
for i in range(n):
    if int(a[i])%2==0:
        num+=1
if num>(num//2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
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 s*2-u>=0 and (t==0 or s*2-u>0):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
bai4 = 0
bai2 = 0
kisuu = 0
for i in a:
    if i%4 == 0:
        bai4 += 1
    elif i%2 == 0:
        bai2 += 1
    else:
        kisuu += 1
if kisuu - 1 <= bai4:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

fourEven = 0
odd = 0
otherEven = 0
for num in n:
    if num % 4 == 0:
        fourEven += 1
    elif num % 2 == 1:
        odd += 1
    else:
        otherEven += 1

# print(len(n) == fourEven + otherEven + otherEven)

if len(n) // 2 <= fourEven:
    print('Yes')
elif odd <= fourEven and otherEven%2==0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split(" ")))
b1 = 0
b2 = 0
b4 = 0
for i in range(len(a)):
    if a[i]%4 == 0:
        b4 += 1
    elif a[i]%2 == 0:
        b2 +=1
    else:
        b1 +=1
# print("{0},{1},{2}".format(b1,b2,b4)) 
# ?print(value, sep, end, file, flush)
b4 += b2//2
b1+=b2%2
# if b2 > 1:
#     b1 += b2%2
if b4 >= b1 - 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
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]

print('Yes' if n1 <= n4 else 'No')

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
a=map(int,input().split())
num=[0,0,0]
for i in a:
  if(i%4==0):num[0]+=1
  elif(i%2==0):num[1]+=1
  else:num[2]+=1
if(num[2]==0):print("Yes")
elif(num[2]==1):
  if(num[0]!=0):print("Yes")
  else:print("No")
else:
  if(num[2]>num[0]+1):print("No")
  else:
    if(num[2]==num[0]+1):
      if(num[1]==0):print("Yes")
      else:print("No")
    else:print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
x=[0,0,0]

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

if (x[1]==0 and x[2] >= x[0]) or x[2] > x[0] or x[0]==0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
x=[0,0,0]

for i in a:
  if i % 4==0:
    x[2]+=1
  elif i % 2==0:
    x[1]+=1
  else:
    x[0]+=1
 
if x[2] > x[0] or x[0]==0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(i) for i in input().split()]

cnt0 = 0
cnt2 = 0
cnt4 = 0

for i in range(n):
    if A[i] % 4 == 0:
        cnt4 += 1
    elif A[i] % 2 == 0:
        cnt2 += 1
    else:
        cnt0 += 1
        
if cnt4 >= cnt0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(i) for i in input().split()]

cnt2 = 0
cnt4 = 0

for i in range(n):
    if A[i] % 4 == 0:
        cnt4 += 1
    elif A[i] % 2 == 0:
        cnt2 += 1
        
flag = False
for i in range(cnt4+1):
    if i + 1   >= n - cnt2 - (cnt4-i)*2 :
        flag = True

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

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(i) for i in input().split()]

cnt2 = 0
cnt4 = 0

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(i) for i in input().split()]

cnt2 = 0
cnt4 = 0

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(i) for i in input().split()]

cnt2 = 0
cnt4 = 0

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

if cnt4 * 2 + cnt2 >= n:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b_0=0
b_2=0
b_4=0
for i in a:
    if i%4==0:
        b_4+=1
    elif i%2==0:
        b_2+=1
    else:
        b_0+=1
print(b_4,b_2,b_0)
if b_2==0:
    if b_0<=b_4+1:
        print("Yes")
    else:
        print("No")
else:
    if b_0<=b_4:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b_0=0
b_2=0
b_4=0
for i in a:
    if i%4==0:
        b_4+=1
    elif i%2==0:
        b_2+=1
    else:
        b_0+=1
if b_2==0:
    if b_4<=b_0+1:
        print("Yes")
    else:
        print("No")
else:
    if b_0<=b_4:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n=input()
nums=list(map(int,input().split(" ")))
n4=0
m2=0
m4=0
for num in nums:
  if num%4!=0:
    n4+=1
  if num%4==0:
    m4+=1
  elif num%2==0:
    m2+=1
if n4-m2<=m4+1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b_1=0
b_2=0
b_4=0
for i in range(n):
    if a[i]//2==0:
        b_1+=1
    elif a[i]//2==1:
        b_2+=1
    elif 2<=a[i]//2:
        b_4+=1
if b_2==0 and b_1<=b_4+1:
    print("Yes")
elif b_1<=b_4:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b_1=[]
b_2=[]
b_4=[]
for i in range(n):
    if a[i]//2==0:
        b_1.append(i)
    elif a[i]//2==1:
        b_2.append(i)
    elif 2<=a[i]//2:
        b_4.append(i)
if len(b_1)<=len(b_4)+1 or len(b_1)<= len(b_4):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
R = [0 for i in range(3)]
st = input().split()
for i in range(N):
    k = int(st[i])
    m = 0
    if k % 4 == 1 or k % 4 == 3:
        m = 0
    elif k % 4 == 2:
        m = 1
    else:
        m = 2
    R[m] += 1


if R[1]+R[2]*2 < 2*(N-1):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import itertools
N = int(input())
a = list(input().split())
all_list = list(itertools.permutations(a))
flag = False
for list in all_list:
    for i in range(len(list)-1):
        if int(a[i]) * int(a[i+1]) % 4 != 0:
            break
    print("Yes")
    flag = True
    break
if flag != True:
    print("No")

Submission status: Wrong Answer

Solution code:

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

n1, n4 = 0, 0

for x in xs:
    if x % 4 == 0:
         n4 += 1
    elif x % 2 == 0:
         continue
    else:
         n1 += 1
         
print("Yes" if n4 >= n1 + 1 else "No")

Submission status: Wrong Answer

Solution code:

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

n1, n4 = 0, 0

for x in xs:
    if x % 4 == 0:
         n4 += 1
    elif x % 2 == 0:
         continue
    else:
         n1 += 1

print("Yes" if n4 >= n1 - 1 else "No")

Submission status: Wrong Answer

Solution code:

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

n1, n4 = 0, 0

for x in xs:
    if x % 4 == 0:
         n4 += 1
    elif x % 2 == 0:
         continue
    else:
         n1 += 1

print("Yes" if n4 >= n1 else "No")

Submission status: Wrong Answer

Solution code:

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

n1, n4 = 0, 0

for x in xs:
    if x % 4 == 0:
         n4 += 1
    elif x % 2 == 0:
         continue
    else:
         n1 += 1


print("Yes" if n4 >= n1 - 1 else "No")

Submission status: Wrong Answer

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

num2 = 0
num4 = 0
numo = 0

for a in A:
    if a%4 == 0:
        num4 += 1
    elif a == 2:
        num2 += 1
    else:
        numo += 1

if num2 == 0:
    if num4 + 1 >= numo:
        print("Yes")
    else:
        print("No")
else:
    if num4 >= numo:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

n4 = len(list(filter(lambda x: x % 4 == 0, A)))
num2 = max(0, A.count(2) - 1)
N -= num2

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

Submission status: Wrong Answer

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

n4 = len(list(filter(lambda x: x % 4 == 0, A)))
num2 = A.count(2) - 1
N -= num2

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

Submission status: Wrong Answer

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

n4 = len(list(filter(lambda x: x%4 == 0, A)))
num2 = A.count(2)
n4 += num2 // 2
num2 = num2 % 2

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

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
a = [int(i[-2:])for i in raw_input().split(" ")]

c1 = 0
c2 = 0

for ai in a:
    if ai % 2 != 0:
        c1 += 1
    elif ai % 4 == 0:
        c2 += 1
print a,c1,c2
if c1 <= c2:
    print "Yes"
elif c1 - 1 == c2 and N == c1 + c2:
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
a = map(int, raw_input().split(" ")[-2:])

c1 = 0
c2 = 0

for ai in a:
    if ai % 2 != 0:
        c1 += 1
    elif ai % 4 == 0:
        c2 += 1
if c1 <= c2:
    print "Yes"
elif c1 - 1 == c2 and N == c1 + c2:
    b = 4/0
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
a = map(int, raw_input().split(" ")[-2:])

c1 = 0
c2 = 0

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

print "Yes" if(c1 <= c2 or (c1 - 1 == c2 and N == c1 + c2))else "No"

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
a = map(int, raw_input().split(" ")[-2:])

c1 = 0
c2 = 0

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

print "Yes" if(c1 <= c2)else "No"

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
a = map(int, raw_input().split(" ")[-2:])

c1 = 0
c2 = 0

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

print "Yes" if(c1 < c2)else "No"

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
a = map(int, raw_input().split(" ")[-2:])

c1 = 0
c2 = 0

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

print "YES" if(c1 < c2)else "NO"

Submission status: Wrong Answer

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

c = [0,0,0,0]
for x in a:
    c[x % 4] += 1


if c[1] + c[3] < c[0] + 1 and(c[2]!=0):
    print('Yes')
elif (c[1] + c[3] == c[0] + 1)and(c[2] == 0):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
a_n4 = a_4 = [x for x in a if x%4!=0]
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]

if (len(a_n4)<=1+len(a_4) and len(a_2)<=1) or (len(a_n4)<=len(a_4) and len(a_2)>1):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
a_n4 = a_4 = [x for x in a if x%4!=0]
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]

if (len(a_n4)<=1+len(a_4) and len(a_2)<=1) or (len(a_n4)<=len(a_4) and len(a_2)==0):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
a_n4 = a_4 = [x for x in a if x%4!=0]
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]

if (len(a_n4)<=1+len(a_4) and len(a_2)==0) or (len(a_n4)<=len(a_4) and len(a_2)!=0):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
a_n4 = a_4 = [x for x in a if x%4!=0]
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]

print("Yes "if (len(a_n4)-2-(int(len(a_2)/2))<=len(a_4)) or (len(a_2)==n) else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
a_n4 = a_4 = [x for x in a if x%4!=0]
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]


print("Yes "if (len(a_n4)-1-(int(len(a_2)/2))<=len(a_4)) or (len(a_2)==len(a)) else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
a_n4 = a_4 = [x for x in a if x%4!=0]
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]


print("Yes "if (len(a_n4)-1-(int(len(a_2)/2))<=len(a_4)) else "No")