stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

const int N=1e5+5;

int a[N];

int main()

{

    int n;

    cin>>n;

    int cnt4=0,cnt2=0;

    for(int i=0; i<n; i++)

    {

        cin>>a[i];

        a[i]%=4;

        if(a[i]==0)

            cnt4++;

        else if(a[i]==2)

            cnt2++;

    }

    int cnt=n-cnt2-cnt4;

    if(cnt2)

    {

        if(cnt4>=cnt){

            cout<<"Yes";

            return 0;

        }

    }

    else

    {

        if(cnt4&&(cnt4+1>=cnt)){

            cout<<"Yes";

            return 0;

        }

    }

    cout<<"No";

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2903063598243305x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

const int INF = 1e9;

const ll LINF = 1e18;



/*

<url:https://arc080.contest.atcoder.jp/tasks/arc080_a>

問題文============================================================

 長さ N の数列 a=(a1,a2,…,aN) があります。 各 ai は正の整数です。

 

 すぬけ君の目標は、a の要素を自由に並べ替え、次の条件が成り立つようにすることです。

 

 各 1≤i≤N−1 について、ai と ai+1 の積は 4 の倍数である。

 すぬけ君が目標を達成できるか判定してください。



=================================================================



解説=============================================================



 まず、4の倍数の数値(4の倍数を v 、４の倍数でない値を x とする）が存在する時

 

 x v x v x v x v ... とおいていけば条件を満たす

 つまり、4の倍数である値の個数を V とすると 2*V 分カバーできる

 

 注意：

     x v x v x v ... x v x

 で数列が終了する時 2*V + 1 ＝＝　N をカバーできる

 

 2*c で　数列全てをカバーできない時, ２の倍数をb とすると

 

 x v x v x v x v ... x v b b b b b b .... b

 

 とおいていけば条件を満たす

 

 よって上の注意ケースを除いて,２の倍数の個数とBとすると

 

 2*V + B >= N

 

 となっていれば条件を満たす



================================================================

*/

int main(void) {

	cin.tie(0); ios::sync_with_stdio(false);

    ll N; cin >> N;

    vector<ll> a(N);

    for(auto & in:a) cin >> in;

    ll four = 0, two = 0;

    for(int i = 0; i < N;i++){

        if(a[i]%4 == 0) four++;

        if(a[i]%2 == 0) two++;

    }

    two -= four;

    if(four*2 + 1 >= N){

        cout << "Yes" << endl;

        return 0;

    }

    if(four*2 + two >= N){

        cout << "Yes" << endl;

    }else{

        cout << "No" << endl;

    }

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.424079015709491x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
    #include<bits/stdc++.h>

    using namespace std;

    int n, dp[10000000], c = 0, cnt = 0;

    int main()

    {

      cin >> n;

      for(int i = 1; i <= n; i ++)

      {

            cin >> dp[i];

            if(dp[i] % 4 == 0)

                  c ++;

            else

            if(dp[i] % 2 == 0)

                  cnt ++;

      }



      if((c + cnt / 2) >= n / 2)

            cout << "Yes";

      else

            cout << "No";

     }


// Faster C++ solution for the same problem (measured speedup: 5.24729892559539x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



int n , a , ch , d;



int main()

{

	cin >> n;

	for(int i = 0 ;  i < n ; i++)

	{

		cin >> a;

		if(a % 4 == 0)

			ch++;

		else if(a % 2 == 0)

			d++;

	}

	if(ch >= n / 2)

		cout << "Yes";

	else

	{

		if(d >= n - (ch * 2))

			cout << "Yes";

		else

			cout << "No";

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.2466430382764155x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int Maxn=1e5+100;

int n,a,k,out[Maxn];

vector <int> vec1,vec2,vec4;

int main(){

	cin>>n;

	for(int i=0,a;i<n;i++){

		cin>>a;

		if(a%4==0)

			vec4.push_back(a);

		else if(a%2==0)

			vec2.push_back(a);

		else

			vec1.push_back(a);

	}

	k=4;

	for(int i=0;i<n;i++){

		if(k==1){

			if(vec4.size()==0){

				cout<<"No";

				return 0;

			}

			vec4.pop_back();

			k=4;

		}

		else if(k==2){

			if(vec2.size()!=0)

				vec2.pop_back(),k=2;

			else if(vec4.size()!=0)

				vec4.pop_back(),k=4;

			else{

				cout<<"No";

				return 0;

			}

		}

		else if(k==4){

			if(vec1.size()!=0)

				vec1.pop_back(),k=1;

			else if(vec2.size()!=0)

				vec2.pop_back(),k=2;

			else if(vec4.size()!=0)

				vec4.pop_back(),k=4;

		}

	}

	cout<<"Yes";

}


// Faster C++ solution for the same problem (measured speedup: 5.306474856783472x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstring>

#include <cmath>

#include <algorithm>

#include <ctype.h>

#include <vector>

#include <map>

using namespace std;

typedef long long LL;

#define INF 0x3fffffff

#define MAXSIZE 100005

//const double eps=1e-8;

//#define Equ(a,b) ((fabs((a)-(b)))<(eps))

//const double pi=acos(-1.0);



int main(){

    int n;

    int a0=0,a1=0,a2=0;

    scanf("%d",&n);

    for (int i=0; i<n; i++) {

        int b;

        scanf("%d",&b);

        if (b%4==0) {

            a2++;

        }

        else if (b%2==0){

            a1++;

        }

        else{

            a0++;

        }

    }

    if (a1==0&&a2>=a0-1) {

        printf("Yes\n");

    }

    else if (a2>=a0){

        printf("Yes\n");

    }

    else{

        printf("No\n");

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.230897396117901x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int N = 1e2+9;

const double pi = acos(-1.0);

#define ll long long

ll dp[N];

ll a[N];

ll n,m,d,x;

int _,__,___;

int main()

{

   // freopen("in.txt","r",stdin);

   cin>>n;

   for(int i = 0; i < n; i++)

   {

       int t;

       cin>>t;

       if(t%4==0) _++;

       else if(t%2==0) __++;

       else ___++;

   }

   if(_>=(n>>1) || _ >= ___) cout<<"Yes"<<endl;

   else cout<<"No"<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.31534612957837x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int N = 1e2+9;

const double pi = acos(-1.0);

#define ll long long

//ll dp[N];

//ll a[N];

ll n,m,d,x;

int _,__,___;

int main()

{

  //  freopen("in.txt","r",stdin);

  

ios::sync_with_stdio(false);

 cin>>n;

   for(int i = 0; i < n; i++)

   {

       int t;

       cin>>t;

       if(t%4==0) _++;

       else if(t%2==0) __++;

       else ___++;

   }

   if(_>=(n>>1) || _ >= ___) cout<<"Yes"<<endl;

   else cout<<"No"<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.38078562653988x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main(){

	int n;cin >> n;

	int cnt = 0,cnt1 = 0, cnt2= 0;

	int a;

	for(int i = 0; i < n; i++){

		cin >> a;

		if(a% 4 == 0) cnt ++;

		else{

			if(a&1) cnt1++;

			else cnt2++;

		}

	}

	if(cnt2>0 && cnt1<=cnt)

		printf("Yes\n");

	else if(cnt2==0 && cnt1<=cnt+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.277383666518776x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;

typedef pair <int, int> pii;



const int maxn = 100001;



int n,a,q,w,e,s;



void input();

void solve();



int main(){

	input();

	solve();

	

	return 0;

}

void input(){

	cin>>n;

	for (int i=0;i<n;i++){

		cin>>a;

		if (a%4==0){

			q++;

		}

		else{

			if (a%2==0){

				w++;

			}

			else{

				e++;

			}

		}

		s++;

	}

	

}

void solve(){

	if (w>0){

		e++;

	}

	while(q>=2 and e>=2){

		q-=2;

		e-=2;

	}

	e--;

	if (e>q){

		cout<<"No";

	}

	else{

		cout<<"Yes";

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.282116768596161x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int main(int argc, char const *argv[])

{

	int N;

	int ai, a1, a2, a4;



	a1 = a2 = a4 = 0;

	cin >> N;



	while(N--)

	{

		cin >> ai;

		if(ai % 4 == 0)

			a4++;

		else if(ai % 2 == 0)

			a2++;

		else

			a1++;

	}



	if(a2 == 0 && a4 >= a1-1)

		cout << "Yes";

	else if(a2 != 0 && a4 >= a1)

	{

		if(a4 != 0)

			cout << "Yes";

		else if(a2 > 1)

			cout << "Yes";

		else

			cout << "No";

	}

	else

		cout << "No";

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.288095323669248x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,ans1=0,ans2=0,temp;

    cin>>n;

	for(int i=0;i<n;i++)

	{

		cin>>temp;

		if(temp%2==0)

		{

			if(temp%4==0)

				ans1++;

			else

				ans2++;

		}

	} 

	n=n-ans2-ans1;

	if(ans2==0)

	{

		if(n<=ans1+1)

		cout<<"Yes\n";

		else

			cout<<"No\n";

	}

	else

	{

		if(n<=ans1)

		 	cout<<"Yes\n";

		else

			cout<<"No\n";

	}

    return 0;

    

}

// Faster C++ solution for the same problem (measured speedup: 5.287722768401138x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

using namespace std;



int main(){

	int n,*a,i,k_2=0,k_4=0;

	scanf("%d",&n);

	a=new int[n];

	for(i=0;i<n;i++){

		scanf("%d",&a[i]);

		if(a[i]%4==0){

			k_4++;

		}

		else if(a[i]%2==0){

			k_2++;

		}

	}

	if(k_4>=n/2){

		printf("Yes");

	}

	else{

		if((2*k_4+k_2)>=n){

			printf("Yes");

		}

		else{

			printf("No");

		}

	}

	return 0;

	system("pause");

}

// Faster C++ solution for the same problem (measured speedup: 5.235702140556858x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <vector>

#include <list>

#include <climits>

#include <queue>

#include <string>

#include <map>

#include <stack>

#include <cmath>

#include <regex>

#include<ctime>

#include<set>

using namespace std;

int main()

{

ios::sync_with_stdio(false);

int n;

int d[100000];

cin>>n;

int i1=0,i2=0;

for(int i=0;i<n;i++)

{

     cin>>d[i];

     if(d[i]%4==0)

        i1++;

     else if(d[i]%2!=0)

        i2++;

}

if(i1+i2==n&&i2==i1+1)

    cout<<"Yes"<<endl;

else if(i1>=i2)

    cout<<"Yes"<<endl;

else

    cout<<"No"<<endl;







}


// Faster C++ solution for the same problem (measured speedup: 5.409074407367041x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main ()

{

	int n,i,j,k,mod2=0,mod4=0,gg=0;

	int a[100005];

	cin>>n;

	for(i=0; i<n; i++)

	{

		cin>>a[i];

		if(a[i]%4==0)

			mod4++;

		else if(a[i]%2==0)

			mod2++;

		else

			gg++;

	}

	if(mod4>=gg)

		cout<<"Yes"<<endl;

	else //mod4 < gg

	{

		if(mod2 == 0)

		{

			if(mod4+1>=gg)

				cout<<"Yes";

			else

				cout<<"No";

		}

		else// mod4<gg && mod2!=0

		{

			//if( 2 * mod4 + mod2 >= n )

			if(mod4 >= gg)

				cout<<"Yes";

			else

				cout<<"No";

		}

	}



	return 0;

}

/*分类讨论下。

显然，任意数和 4 的倍数相乘，其结果仍是 4 的倍数；

显然，若存在任意数量 2 的倍数，两两之间乘起来就是 4 的倍数；

如果存在一个数既不是 4 的倍数，也不是 2 的倍数（即因子里没有 2 ）：

放在 2 的倍数旁边，一定不符合要求；

放在 4 的倍数旁边，两两相乘一定是 4 的倍数。

因此符合要求的排列一定是，所有 2 的倍数相邻排在一起，

所有 4 的倍数和剩下的数相间排列，这

些剩下的元素个数不能超过 4 的倍数的数量，不

然所有 4 的倍数都被包起来了。*/




// Faster C++ solution for the same problem (measured speedup: 5.335875877780049x):
#include <cstdio>



int main(void)

{

	int a1count=0,a2count=0,a4count=0;

	int i,N,x;

	scanf("%d",&N);

	while(N--)

	{

		scanf("%d",&x);

		if(x%4==0)

			a4count++;

		else if(x%2==0)

			a2count++;

		else

			a1count++;

	}

	if(a2count>0 && a1count<=a4count)

		printf("Yes\n");

	else if(a2count==0 && a1count<=a4count+1)

		printf("Yes\n");

	else

		printf("No\n");



	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

const int N=1e5+5;

int a[N];

int main()

{

    int n;

    cin>>n;

    int cnt4=0,cnt2=0;

    for(int i=0; i<n; i++)

    {

        cin>>a[i];

        a[i]%=4;

        if(a[i]==0)

            cnt4++;

        else if(a[i]==2)

            cnt2++;

    }

    int cnt=n-cnt2-cnt4;

    if(cnt2)

    {

        if(cnt4>=cnt){

            cout<<"Yes";

            return 0;

        }

    }

    else

    {

        if(cnt4&&(cnt4+1>=cnt)){

            cout<<"Yes";

            return 0;

        }

    }

    cout<<"No";

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.28413372441948x):
#include<stdio.h>

int cnt1, cnt2, cnt4;

int n;

int x;

int main()

{

	scanf("%d", &n);

	for(int i = 0; i < n; i++)

	{

		scanf("%d", &x);

		if(x % 4 == 0)

			cnt4 ++;

		else if(x % 2 == 0)

			cnt2 ++;

		else 

			cnt1 ++;

	}

	if(cnt4 >= cnt1)

		printf("Yes\n");

	else if(cnt2 == 0 && cnt4 + 1>= cnt1)

		printf("Yes\n");

	else

		printf("No\n");

	return 0;

}
// Slower C++ solution:
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

const int INF = 1e9;

const ll LINF = 1e18;



/*

<url:https://arc080.contest.atcoder.jp/tasks/arc080_a>

問題文============================================================

 長さ N の数列 a=(a1,a2,…,aN) があります。 各 ai は正の整数です。

 

 すぬけ君の目標は、a の要素を自由に並べ替え、次の条件が成り立つようにすることです。

 

 各 1≤i≤N−1 について、ai と ai+1 の積は 4 の倍数である。

 すぬけ君が目標を達成できるか判定してください。



=================================================================



解説=============================================================



 まず、4の倍数の数値(4の倍数を v 、４の倍数でない値を x とする）が存在する時

 

 x v x v x v x v ... とおいていけば条件を満たす

 つまり、4の倍数である値の個数を V とすると 2*V 分カバーできる

 

 注意：

     x v x v x v ... x v x

 で数列が終了する時 2*V + 1 ＝＝　N をカバーできる

 

 2*c で　数列全てをカバーできない時, ２の倍数をb とすると

 

 x v x v x v x v ... x v b b b b b b .... b

 

 とおいていけば条件を満たす

 

 よって上の注意ケースを除いて,２の倍数の個数とBとすると

 

 2*V + B >= N

 

 となっていれば条件を満たす



================================================================

*/

int main(void) {

	cin.tie(0); ios::sync_with_stdio(false);

    ll N; cin >> N;

    vector<ll> a(N);

    for(auto & in:a) cin >> in;

    ll four = 0, two = 0;

    for(int i = 0; i < N;i++){

        if(a[i]%4 == 0) four++;

        if(a[i]%2 == 0) two++;

    }

    two -= four;

    if(four*2 + 1 >= N){

        cout << "Yes" << endl;

        return 0;

    }

    if(four*2 + two >= N){

        cout << "Yes" << endl;

    }else{

        cout << "No" << endl;

    }

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.417750296748084x):
#include<stdio.h>

int cnt1, cnt2, cnt4;

int n;

int x;

int main()

{

	scanf("%d", &n);

	for(int i = 0; i < n; i++)

	{

		scanf("%d", &x);

		if(x % 4 == 0)

			cnt4 ++;

		else if(x % 2 == 0)

			cnt2 ++;

		else 

			cnt1 ++;

	}

	if(cnt4 >= cnt1)

		printf("Yes\n");

	else if(cnt2 == 0 && cnt4 + 1>= cnt1)

		printf("Yes\n");

	else

		printf("No\n");

	return 0;

}
// Slower C++ solution:
    #include<bits/stdc++.h>

    using namespace std;

    int n, dp[10000000], c = 0, cnt = 0;

    int main()

    {

      cin >> n;

      for(int i = 1; i <= n; i ++)

      {

            cin >> dp[i];

            if(dp[i] % 4 == 0)

                  c ++;

            else

            if(dp[i] % 2 == 0)

                  cnt ++;

      }



      if((c + cnt / 2) >= n / 2)

            cout << "Yes";

      else

            cout << "No";

     }


// Faster C++ solution for the same problem (measured speedup: 5.241176470500174x):
#include<stdio.h>

int cnt1, cnt2, cnt4;

int n;

int x;

int main()

{

	scanf("%d", &n);

	for(int i = 0; i < n; i++)

	{

		scanf("%d", &x);

		if(x % 4 == 0)

			cnt4 ++;

		else if(x % 2 == 0)

			cnt2 ++;

		else 

			cnt1 ++;

	}

	if(cnt4 >= cnt1)

		printf("Yes\n");

	else if(cnt2 == 0 && cnt4 + 1>= cnt1)

		printf("Yes\n");

	else

		printf("No\n");

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



int n , a , ch , d;



int main()

{

	cin >> n;

	for(int i = 0 ;  i < n ; i++)

	{

		cin >> a;

		if(a % 4 == 0)

			ch++;

		else if(a % 2 == 0)

			d++;

	}

	if(ch >= n / 2)

		cout << "Yes";

	else

	{

		if(d >= n - (ch * 2))

			cout << "Yes";

		else

			cout << "No";

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.240521348458861x):
#include<stdio.h>

int cnt1, cnt2, cnt4;

int n;

int x;

int main()

{

	scanf("%d", &n);

	for(int i = 0; i < n; i++)

	{

		scanf("%d", &x);

		if(x % 4 == 0)

			cnt4 ++;

		else if(x % 2 == 0)

			cnt2 ++;

		else 

			cnt1 ++;

	}

	if(cnt4 >= cnt1)

		printf("Yes\n");

	else if(cnt2 == 0 && cnt4 + 1>= cnt1)

		printf("Yes\n");

	else

		printf("No\n");

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int Maxn=1e5+100;

int n,a,k,out[Maxn];

vector <int> vec1,vec2,vec4;

int main(){

	cin>>n;

	for(int i=0,a;i<n;i++){

		cin>>a;

		if(a%4==0)

			vec4.push_back(a);

		else if(a%2==0)

			vec2.push_back(a);

		else

			vec1.push_back(a);

	}

	k=4;

	for(int i=0;i<n;i++){

		if(k==1){

			if(vec4.size()==0){

				cout<<"No";

				return 0;

			}

			vec4.pop_back();

			k=4;

		}

		else if(k==2){

			if(vec2.size()!=0)

				vec2.pop_back(),k=2;

			else if(vec4.size()!=0)

				vec4.pop_back(),k=4;

			else{

				cout<<"No";

				return 0;

			}

		}

		else if(k==4){

			if(vec1.size()!=0)

				vec1.pop_back(),k=1;

			else if(vec2.size()!=0)

				vec2.pop_back(),k=2;

			else if(vec4.size()!=0)

				vec4.pop_back(),k=4;

		}

	}

	cout<<"Yes";

}


// Faster C++ solution for the same problem (measured speedup: 5.300283356263828x):
#include<stdio.h>

int cnt1, cnt2, cnt4;

int n;

int x;

int main()

{

	scanf("%d", &n);

	for(int i = 0; i < n; i++)

	{

		scanf("%d", &x);

		if(x % 4 == 0)

			cnt4 ++;

		else if(x % 2 == 0)

			cnt2 ++;

		else 

			cnt1 ++;

	}

	if(cnt4 >= cnt1)

		printf("Yes\n");

	else if(cnt2 == 0 && cnt4 + 1>= cnt1)

		printf("Yes\n");

	else

		printf("No\n");

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstring>

#include <cmath>

#include <algorithm>

#include <ctype.h>

#include <vector>

#include <map>

using namespace std;

typedef long long LL;

#define INF 0x3fffffff

#define MAXSIZE 100005

//const double eps=1e-8;

//#define Equ(a,b) ((fabs((a)-(b)))<(eps))

//const double pi=acos(-1.0);



int main(){

    int n;

    int a0=0,a1=0,a2=0;

    scanf("%d",&n);

    for (int i=0; i<n; i++) {

        int b;

        scanf("%d",&b);

        if (b%4==0) {

            a2++;

        }

        else if (b%2==0){

            a1++;

        }

        else{

            a0++;

        }

    }

    if (a1==0&&a2>=a0-1) {

        printf("Yes\n");

    }

    else if (a2>=a0){

        printf("Yes\n");

    }

    else{

        printf("No\n");

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.224794078035678x):
#include<stdio.h>

int cnt1, cnt2, cnt4;

int n;

int x;

int main()

{

	scanf("%d", &n);

	for(int i = 0; i < n; i++)

	{

		scanf("%d", &x);

		if(x % 4 == 0)

			cnt4 ++;

		else if(x % 2 == 0)

			cnt2 ++;

		else 

			cnt1 ++;

	}

	if(cnt4 >= cnt1)

		printf("Yes\n");

	else if(cnt2 == 0 && cnt4 + 1>= cnt1)

		printf("Yes\n");

	else

		printf("No\n");

	return 0;

}