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

using namespace std;

typedef long long ll;

const int MAXSIZE=30000020;

int bufpos;

char buf[MAXSIZE];

#define NEG 0

void init(){

	#ifdef LOCAL

		freopen("C.txt","r",stdin);

	#endif

	buf[fread(buf,1,MAXSIZE,stdin)]='\0';

	bufpos=0;

}

#if NEG

int readint(){

	bool isneg;

	int val=0;

	for(;!isdigit(buf[bufpos]) && buf[bufpos]!='-';bufpos++);

	bufpos+=(isneg=buf[bufpos]=='-');

	for(;isdigit(buf[bufpos]);bufpos++)

		val=val*10+buf[bufpos]-'0';

	return isneg?-val:val;

}

#else

int readint(){

	int val=0;

	for(;!isdigit(buf[bufpos]);bufpos++);

	for(;isdigit(buf[bufpos]);bufpos++)

		val=val*10+buf[bufpos]-'0';

	return val;

}

#endif

char readchar(){

	for(;isspace(buf[bufpos]);bufpos++);

	return buf[bufpos++];

}

int readstr(char* s){

	int cur=0;

	for(;isspace(buf[bufpos]);bufpos++);

	for(;!isspace(buf[bufpos]);bufpos++)

		s[cur++]=buf[bufpos];

	s[cur]='\0';

	return cur;

}

int a[100002];

int main(){

	init();

	int n=readint(),cnt=0,cnt1=0,cnt2=0;

	while(n--){

		int x=readint();

		if (x%4==0)

			cnt2++;

		else if (x%2==0)

			cnt1++;

		else cnt++;

	}

	int to=cnt2;

	if (!cnt1)

		to++;

	if (cnt>to)

		puts("No");

	else puts("Yes");

}

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

int main()

{

	int n;

	while (scanf("%d", &n) != EOF)

	{

		int four = 0, two = 0,x=0;

		int a;

		while (n--)

		{

			scanf("%d", &a);

			if (a % 4==0)

			{

				four++;

				continue;

			}

			if (a % 2 == 0)

			{

				two++;

				continue;

			}

			x++;

		}

		if (two)

			x++;

		if (four + 1 < x)

			printf("No\n");

		else

			printf("Yes\n");

	}

	return 0;

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

#include <stdio.h>

#include <cstdlib>

using namespace std;



const int N = 200000;

int n;

int a[N];



void init()

{

    cin >> n;

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

    {

        cin >> a[i];

    }

}



void solve()

{

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

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

    {

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

            c4++;

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

            c2++;

        else

            c1++;

    }

    if(c2 > 0)

        c2 = 1;

    if(c1 == 0)

        cout << "Yes" << endl;

    else if(c4 >= c1-1+c2)

        cout << "Yes" << endl;

    else

        cout << "No" << endl;

}



int main()

{

    init();

    solve();

    return 0;

}

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

int main()

{

	int n;

	while (scanf("%d", &n) != EOF)

	{

		int four = 0, two = 0,x=0;

		int a;

		while (n--)

		{

			scanf("%d", &a);

			if (a % 4==0)

			{

				four++;

				continue;

			}

			if (a % 2 == 0)

			{

				two++;

				continue;

			}

			x++;

		}

		if (two)

			x++;

		if (four + 1 < x)

			printf("No\n");

		else

			printf("Yes\n");

	}

	return 0;

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

#include <cstdio>

#include <algorithm>

using namespace std;

int main()

{

	int n;

	while(~scanf("%d",&n))

	{

		int a[500001];

		int flag,flag1,flag2;

		flag=flag1=flag2=0;

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

		{

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

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

				flag++;

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

				flag1++;

			else

				flag2++;

		}

		if(flag1)

			flag2++;

		if(flag2<=flag+1)

			printf("Yes\n");

		else

			printf("No\n");

	}

}

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

int d[100005];

int main()

{

	int n;

	while ( ~scanf( "%d", &n ) )

	{

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

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

		{

			scanf( "%d", d+i );

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

				a++;

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

				b++;

			else

				c++;

		}

		if ( b )

			c++;

		if ( a - c >= -1 )

			printf( "Yes\n" );

		else

			printf( "No\n" );

	}

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

#include <cstdio>

#include <algorithm>

using namespace std;

int main()

{

	int n;

	while(~scanf("%d",&n))

	{

		int a[500001];

		int flag,flag1,flag2;

		flag=flag1=flag2=0;

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

		{

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

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

				flag++;

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

				flag1++;

			else

				flag2++;

		}

		if(flag1)

			flag2++;

		if(flag2<=flag+1)

			printf("Yes\n");

		else

			printf("No\n");

	}

}

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

}
// Slower C++ solution:
// In the name of Allah the Lord of the Worlds.



#include<bits/stdc++.h>

using namespace std;



typedef long long ll;



struct myStruct{



    ll number , fre;



    myStruct(ll _number , ll _fre){



        number = _number;

        fre = _fre;

    }

};



bool operator<(myStruct A , myStruct B)

{



    return A.fre < B.fre;

}



int main(void)

{

    int n;

    scanf("%d",&n);

    vector<myStruct>v;



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



        ll in;

        scanf("%lld",&in);



        ll temp = in , counter = 0;



        while(temp%2==0){



            counter++;

            temp/=2;

        }



        v.push_back(myStruct(in , counter));

    }



    sort(v.begin() , v.end());



    int si = v.size();



    for(int i=0;i<si/2;i++){



        if(v[i].fre+v[si-1-i].fre<2){si = -1; break;}

    }



    if(si==-1)printf("No\n");

    else printf("Yes\n");



    return 0;

}


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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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

using namespace std;

int n,a,b,x,c;

int main()

{

	scanf("%d",&n);

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

		scanf("%d",&x);

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

		else if(x&1)b++;

		else c++;

	}

	if(!c)b--;

	if(a>=b)puts("Yes");

	else puts("No");

	return 0;

}

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

}
// Slower C++ solution:
//周♂雨扬是最强的！！！

//大佬祝您AK

//沈哲♂贝是最强的！！！

#include<iostream>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<fstream>

using namespace std;

//ifstream fin(.in);

//ofstream fout(.out);

int n,one,two,four;

int num[100003];

int main(){

	cin>>n;

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

        cin>>num[i];

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

        	four++;

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

        	two++;

		}else{

        	one++;

		}

    }

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

		cout<<"No"<<endl;

	}else{

		cout<<"Yes"<<endl;

	}

	return 0;

}

//沈♂哲贝是最强的！！！

//大佬祝您AK

//周♂雨扬是最强的！！！

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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

#include <cstring>

#include <cmath>

#include <algorithm>

#include <iostream>

using namespace std;



#define rp(i,t) for(int i=0;i<(t);i++)

#define rep(i,s,t) for(int i=(s);i<=(t);i++)

#define rsp(i,s,t) for(int i=(s);i<(t);i++)

#define rrp(i,t,s) for(int i=(t);i>=(s);i--)

#define rcp(i,s,b,d) for(int i=(s);b;d)

#define mst(a,x) memset(a,x,sizeof(a))

#define INF 0x3f3f3f3f

#define N



#define Dp puts("")

#define Dw printf

#define Ds printf("#")



typedef long long ll;

char ch;

int n,x,sgl,two,four;



inline void read(int &x){x=0;do{ch=getchar();}while(ch<'0'||'9'<ch);do{x=x*10+ch-'0';ch=getchar();}while('0'<=ch&&ch<='9');}



int main(void)

{

	read(n);

	rep(i,1,n)

	{

		read(x);

		if((x&3)==0)four++;

		else if((x&1)==0)two++;

		else sgl++;

	}

	if(four==sgl-1&&two==0)puts("Yes");

	else if(four>=sgl)puts("Yes");

	else puts("No");

	return 0;

}


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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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

using namespace std;

int main()

{

	int n;

	cin >> n;

	int *a = new int[n];

	int tmp = 0;

	int r2 = 0, r4 = 0;

	while (n--)

		cin >> a[tmp++];

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

	{

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

			r4++;

		else

		{

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

				r2++;

		}

	}

	if(tmp%2==1)//jishu

		cout << ((2 * r4 + r2 >= tmp - 1) ? "Yes" : "No") << endl;

	else

		cout << ((2 * r4 + r2 >= tmp) ? "Yes" : "No") << endl;

	return 0;

}

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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





using namespace std;





//1 * 4 or 2 * 2 网上思路

int main() {

	int n;

	scanf("%d", &n);

	int four = 0;

	int two = 0;

	int one = 0;

	int temp;

	while (n--) {

		scanf("%d", &temp);

		if(temp % 4 == 0) {

			four++;

		} else if(temp % 2 == 0) {

			two++;

		} else {

			one++;

		}

	}



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

		printf("No");

	} else {

		printf("Yes");

	}





	return 0;

}

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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

using namespace std;



int main(){

    int n;

    cin>>n;

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

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

        int k;

        cin>>k;

        if(k%4==0)

            a++;

        else if(k%2==0)

            b++;

        else

            c++;

    }

    a-=c;

    if(a>=0||(a==-1&&b==0))

        cout<<"Yes"<<endl;

    else

        cout<<"No"<<endl;

    return 0;

}

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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

#include<iostream>

using namespace std;

int main()

{

	int n;

	scanf("%d",&n);

	int *a=new int[n];

	int odd=0;

	int fou=0;

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

	{

		scanf("%d",a+i);

		if(a[i]&1!=0)

			odd++;

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

			fou++;

	}

	if(fou>=odd||(odd==fou+1&&odd+fou==n))

		printf("Yes");

	else

		printf("No");

	return 0;

}

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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



using namespace std;



typedef long long ll;

typedef unsigned long long ull;

typedef pair<int, int> pii;

typedef vector<int> vi;

typedef vector<ll> vll;

typedef set<int> si;



int main()

{

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int n;

    int t;

    map<int, int> m;

    cin >> n;

    while (n--)

    {

        cin >> t;

        if (t % 4 == 0)

            m[4]++;

        else if (t & 1)

            m[1]++;

        else

            m[2]++;

    }

    if (m[1] <= m[4] || (m[1] <= m[4] + 1 && !m[2]))

        cout << "Yes" << endl;

    else

        cout << "No" << endl;

    return 0;

}

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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

#include<cmath>

using namespace std;





int main(void)

{

	int n = 0;

	cin>>n;

	long long int a[n]={0};

	int four = 0;

	int two = 0;

	int oth = 0;

	int flag = 0;

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

		long long int h =0;

		cin>>h;

		a[k]=h;

	}

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

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

		else if (a[j]%2==0&&a[j]%4!=0) two++;

		else oth++;

	}

	if (two>0) flag = 1;

	if(flag+oth<=four+1) cout<<"Yes";

	else	cout<<"No";

	

	return 0;

}








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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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

#include <cstdio>

#include <cstdlib>

#include <algorithm>



using namespace std;



#define N 200008



int n;

int a[N];



int main()

{

	int four = 0, two = 0, one = 0;

	scanf("%d", &n);

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

	{

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

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

			four ++;

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

			two ++;

		else

			one ++;

	}

	if (one <= four)

		printf("Yes\n");

	else if (one == four + 1)

	{

		if (two == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("No\n");

	return 0;

}

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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

using namespace std;

int a[200005];

int main()

{

	int n, count1, count2;

	while (cin >> n)

	{

		int flag = 0;

		count1 = count2 = 0;

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

		{

			cin >> a[i];

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

				count1++;

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

				count2++;

		}

		if (count2 == count1 + 1 && count2 + count1 == n)    

			flag = 1;

		if (count1 >= count2)      

			flag = 1;

		if (flag)

			cout << "Yes" << endl;

		else

			cout << "No" << endl;

	}

	return 0;

}

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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

#include<iostream>

#include<algorithm>

#define rep(i,l,p) for(int i=l;i<=p;i++)

using namespace std;



const int maxN = 1e6 + 10;

int n;

int ar[maxN];

int a,b,d;

int flag = 0;

void input(){

	scanf("%d",&n);

	rep(i,1,n){

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

		if ( ar[i] % 2 == 0){

			if(ar[i] % 4 == 0) d++;

			else b++;

		}else{

			a++;

		}

	}

}

void solve(){

	if (d>=a && b>0) flag = 1;

	else if ( (d+1)>=a && b==0 && d>0 ) flag = 1;

}

int main(){



	input();

	solve();

	//printf("a:%d\tb:%d\td:%d\n",a,b,d );

	if (flag == 0) printf("No\n");

	else printf("Yes\n");

	

	return 0;

}

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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

using namespace std;

int main ()  

{  

    int n;  

    cin>>n;

    if(n>=2&&n<=100000)

	{

		int a=0,b=0,m,t;  

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

    	{  

        	cin>>t;

			if(t<1&&t>1000000000)

			goto loop;  

        	if(t%2==0)  

        	a++;  

        	if(t%4==0)  

        	b++;  

    	}  

    	m=a-b;  

    	if(n<=2*b+m&&m!=0)  

    	cout<<"Yes";  

    	else if(n<=2*b+1&&m==0)  

    	cout<<"Yes";  

    	else  

    	loop: cout<<"No";  

	}

    cout<<endl;

    return 0;

}  

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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

using namespace std;



int main()

{

	int n;

	int a;//4

	int b;//2

	int c;//else

	while (cin >> n)

	{

		a = 0;

		b = 0;

		c = 0;

		int *p = new int[n];

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

		{

			cin >> p[i];

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

			{

				a++;

			}

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

			{

				b++;

			}

			else

			{

				c++;

			}

		}

		if ((b != 0 && a >= c) || (b == 0 && a >= c - 1))

		{

			cout << "Yes" << endl;

		}

		else

		{

			cout << "No" << endl;

		}

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

		{

			cout << p[i];

		}*/

		free(p);

	}



	return 0;

}

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

using namespace std;



int main()

{

	int temp;

	int n;

	int four, even, odd;

	four = 0;

	even = 0;

	odd = 0;

	scanf("%d", &n);

	while (n--)

	{

		scanf("%d", &temp);

		if (temp % 4 == 0)

			four++;

		else if(temp%2!=0)

		{

			odd++;

		}

		else {

			even++;

		}

	}

	if (odd > four) {

		if (odd - four == 1 && even == 0)

			printf("Yes\n");

		else

			printf("No\n");

	}

	else

		printf("Yes\n");

	return 0;

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

#include <cstdio>

#include <algorithm>

using namespace std;

int main()

{

	int n;

	while(~scanf("%d",&n))

	{

		int a[500001];

		int flag,flag1,flag2;

		flag=flag1=flag2=0;

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

		{

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

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

				flag++;

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

				flag1++;

			else

				flag2++;

		}

		if(flag1)

			flag2++;

		if(flag2<=flag+1)

			printf("Yes\n");

		else

			printf("No\n");

	}

}

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



int main()

{

	int n=0;

	scanf("%d",&n);

	int _4m=0,_2m=0,_1m=0;	

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

	{

		int input=0;

		scanf("%d",&input);

		if(input&1)

		{

			_1m++;

		}

		else if(input%4==0)

		{

			_4m++;

		}

		else

		{

			_2m++;

		}

	}

	if(_1m>_4m+1||(_1m==_4m+1&&_2m!=0)) printf("No\n");

    else printf("Yes\n");

	

	return 0;

}
// Slower C++ solution:
// In the name of Allah the Lord of the Worlds.



#include<bits/stdc++.h>

using namespace std;



typedef long long ll;



struct myStruct{



    ll number , fre;



    myStruct(ll _number , ll _fre){



        number = _number;

        fre = _fre;

    }

};



bool operator<(myStruct A , myStruct B)

{



    return A.fre < B.fre;

}



int main(void)

{

    int n;

    scanf("%d",&n);

    vector<myStruct>v;



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



        ll in;

        scanf("%lld",&in);



        ll temp = in , counter = 0;



        while(temp%2==0){



            counter++;

            temp/=2;

        }



        v.push_back(myStruct(in , counter));

    }



    sort(v.begin() , v.end());



    int si = v.size();



    for(int i=0;i<si/2;i++){



        if(v[i].fre+v[si-1-i].fre<2){si = -1; break;}

    }



    if(si==-1)printf("No\n");

    else printf("Yes\n");



    return 0;

}


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



int main()

{

	int n=0;

	scanf("%d",&n);

	int _4m=0,_2m=0,_1m=0;	

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

	{

		int input=0;

		scanf("%d",&input);

		if(input&1)

		{

			_1m++;

		}

		else if(input%4==0)

		{

			_4m++;

		}

		else

		{

			_2m++;

		}

	}

	if(_1m>_4m+1||(_1m==_4m+1&&_2m!=0)) printf("No\n");

    else printf("Yes\n");

	

	return 0;

}