stablegradients/pie-gem5-pairs huggingface dataset:
// 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.230467326965101x):
#include<math.h>

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+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.314909117296599x):
#include<math.h>

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+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.380343234013212x):
#include<math.h>

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+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.27694977540018x):
#include<math.h>

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+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.2816824883356945x):
#include<math.h>

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+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.287660551869391x):
#include<math.h>

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+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.28728802723169x):
#include<math.h>

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+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.23527167637196x):
#include<math.h>

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+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.408629689019184x):
#include<math.h>

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+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.3354371776021585x):
#include<math.h>

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+1)

			printf("Yes\n");

		else

			printf("No\n");

	}

 	return 0;

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

#include "queue"

#include "algorithm"

#include "iostream"

using namespace std;









int main()

{



	int ou = 0,ji = 0 ,si = 0;

	int a[100003];

	int num;

	scanf("%d",&num);

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

	{

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

	}

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

	{

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

			si++;

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

			ou++;

		else

			ji++;

	}

	int flag = 0;

	if(ou > 0)

		flag = 1;

	if(si + 2 >= ji + 1 + flag)

		printf("Yes");

	else

		printf("No");

	return 0;

}

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

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+1)

			printf("Yes\n");

		else

			printf("No\n");

	}

 	return 0;

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

using namespace std;

const int maxn = 1e6+5;

struct stu{

    int data;

    int x;

};

int main(){

    //struct stu arr[maxn];

    int a=0,b=0,c=0,i,n;

    cin>>n;

    int s;

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

        cin>>s;

        if(s%4==0){

            a++;

        }

        else if(s%2==0){

            b++;

        }

        else{

            c++;

        }

    }

    if(a>=c){

        if(a==0&&b<=1){

            cout<<"No";

        }

        else{

            cout<<"Yes";

        }



    }

    else if(b==0&&c<=a+1){

        cout<<"Yes";

    }

    else{

        cout<<"No";

    }

}


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

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+1)

			printf("Yes\n");

		else

			printf("No\n");

	}

 	return 0;

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

#include <cstdio>

#include <cmath>

#include <string>

#include <cstring>

#include <algorithm>

#include <iomanip>

#include <cstdlib>

#include <cctype>

#define ll long long

#define PI 3.14159265358979323846

using namespace std;

const int maxn = 1e6+7;



int main(){

	int n;

	cin>>n;

	int *a=new int[n];

	int sum=0;

	int sum2=0;

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

		cin>>a[i];

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

			sum++;

		}

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

			sum2++;

		}

	}

	if(sum>=n/2){

		cout<<"Yes"<<endl;

	}

	else if(sum+sum2/2>=n/2&&sum2>=2){

		cout<<"Yes"<<endl;

	}

	else{

		cout<<"No"<<endl;

	}

	return 0;

}


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

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+1)

			printf("Yes\n");

		else

			printf("No\n");

	}

 	return 0;

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



using namespace std;



const int maxn = 1e5 + 5;



int a[maxn];



int main()

{

	int n;

	scanf("%d",&n);

	int four = 0;

	int two = 0;

	int one = 0;

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

	{

		cin >> a[i];

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

			four++;

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

			two++;

		else

			one++;

	}

	

	if(one > four + 1|| (one == four + 1 && two != 0))

		cout << "No" << endl;

	else

		cout << "Yes" << endl; 

	return 0;

}

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

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+1)

			printf("Yes\n");

		else

			printf("No\n");

	}

 	return 0;

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

using namespace std;



int main() {

	ios::sync_with_stdio(0);

	cin.tie(0); cout.tie(0);

	int n; cin >> n;

	int c1 = 0, c2 = 0, c4 = 0;

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

		int x; cin >> x;

		if(x % 4 == 0) ++ c4;

		else if(x % 2 == 0) ++ c2;

		else ++ c1;

	}

	if(c4 < c1 - 1) cout << "No\n";

	else {

		if(c4 == c1 - 1 && c2) cout << "No\n";

		else cout << "Yes\n";

	}

	return 0;

}


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

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+1)

			printf("Yes\n");

		else

			printf("No\n");

	}

 	return 0;

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

using namespace std;



int cnt2, cnt1, cnt4;

int main(){

	int n;

	cin >> n;

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

		int x;

		cin >> x;

		if(x % 4 == 0) cnt4 ++;

		else if(x % 2 == 0) cnt2 ++;

		else cnt1 ++;

	}

	if(cnt1 > cnt4 + 1){

		cout << "No" << '\n';

	}

	else if(cnt1 == cnt4 + 1){

		if(cnt2 == 0) cout << "Yes" << '\n';

		else cout << "No" << '\n';

	}

	else {

		cout << "Yes" << '\n';

	}

}


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

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+1)

			printf("Yes\n");

		else

			printf("No\n");

	}

 	return 0;

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

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int n,f1,f2,f3;

void solve(){

	int x;

	cin >> n;

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

		scanf("%d",&x);

		if(x % 4 == 0) f1 ++;

		else if(x % 2 == 0) f2 ++;

		else f3 ++;

	}

	if(!f2 && f3 == f1 + 1) cout << "Yes" << "\n";

	else if(f1 >= f3) cout << "Yes" << endl;

	else cout << "No" << endl;

}



int main(){

	solve();

	return 0;

}

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

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+1)

			printf("Yes\n");

		else

			printf("No\n");

	}

 	return 0;

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

using namespace std;

int main()

{

    int n, n_4 = 0, n_2 = 0, n_other = 0, temp;

    cin >> n;

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

    {

        cin >> temp;

        if(temp % 4 == 0)

            n_4++;

        else if(temp % 2 == 0)

            n_2++;

        else

            n_other++;

    }

    if(n_2 != 0)

    {

        if(n_4 >= n_other)

            cout << "Yes" << endl;

        else

            cout << "No" << endl;

    }

    else

    {

        if(n_4 >= n_other - 1)

            cout << "Yes" << endl;

        else

            cout << "No" << endl;

    }

    return 0;

}


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

#include<string.h>

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<algorithm>

#include<string>

#include<queue>

#include<vector>

#include<stack>

#include<set>

#include<map>

using namespace std;



int ser[1000010];

int main()

{

	int c1, c2, c4;

	int n,temp;

	c1 = c2 = c4 = 0;

	scanf("%d", &n);

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

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			c4++;

		else if (temp % 2 == 0)

			c2++;

		else

			c1++;

	}

	if (c2 != 0)

	{

		if (c1 <= c4)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

	{

		if(c1<=c4+1)

			printf("Yes\n");

		else

			printf("No\n");

	}

 	return 0;

}