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

using namespace std;

int read(){

	char c=getchar();while (c!='-'&&(c<'0'||c>'9'))c=getchar();

	int kk=1,k=0;if (c=='-')kk=-1,c=getchar();

	while (c>='0'&&c<='9')k=k*10+c-'0',c=getchar();return kk*k;

}int n,x,y,xx,yy,zz;

int main(){

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

		x=read();y=0;while (x%2==0)x/=2,y++;

		if (y>=2)zz++;else if (y==0)xx++;else yy++;

	}if (yy){

		if (xx>zz)puts("No");else puts("Yes");

	}else if (xx>zz+1)puts("No");else puts("Yes");

}


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



const int max=100000+5;



int main(){

	int a[max]={0};

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

	

	scanf("%d",&n);

	

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

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

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

			four++;

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

			two++;

		else

			one++;

	} 

	

	if(two==0){

		if(four>=one-1)

			flag=1;

	}

	else{

		if(four>=one)

			flag=1;

	}

	

	if(flag==1)

		printf("Yes");

	else

		printf("No");

		

	return 0;

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

#define Ll long long

using namespace std;

const int N=2e5+5;

int n,m,x,y,c;

int main()

{

	scanf("%d",&n);

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

		cin>>c;m=0;

		if(c%2==0)m++;

		if(c%4==0)m++;

		if(m==1)x++;

		if(m==2)y++;

	}

//	cout<<x<<' '<<y<<endl;

	if(y>=n-x-y)puts("Yes");else 

	if(!x&&y==n/2)puts("Yes");else puts("No");

}

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



const int max=100000+5;



int main(){

	int a[max]={0};

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

	

	scanf("%d",&n);

	

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

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

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

			four++;

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

			two++;

		else

			one++;

	} 

	

	if(two==0){

		if(four>=one-1)

			flag=1;

	}

	else{

		if(four>=one)

			flag=1;

	}

	

	if(flag==1)

		printf("Yes");

	else

		printf("No");

		

	return 0;

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

using namespace std;

int n,x,c1,c2,c4;

int main(){

	scanf("%d",&n);

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

		scanf("%d",&x);

		if (x&1) c1++;

		else if (x%4) c2++;

		else c4++;

	}

	puts(c4>=c1+(c2!=0)-1?"Yes":"No");

}

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



const int max=100000+5;



int main(){

	int a[max]={0};

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

	

	scanf("%d",&n);

	

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

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

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

			four++;

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

			two++;

		else

			one++;

	} 

	

	if(two==0){

		if(four>=one-1)

			flag=1;

	}

	else{

		if(four>=one)

			flag=1;

	}

	

	if(flag==1)

		printf("Yes");

	else

		printf("No");

		

	return 0;

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

#include <algorithm>

using namespace std;



const int N = 1e5 + 5;



int n, a[N], cc[N], p[5];



int main() {

	ios::sync_with_stdio(false);

	cin >> n;

	int cnt = 0;

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

		cin >> a[i];

		for (int t = a[i], cnt = 0; t % 2 == 0 && t; cc[i] = ++cnt, t /= 2)

			;

		cc[i] = min(cc[i], 2);

	}

	sort(cc + 1, cc + n + 1);

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

		++p[cc[i]];

	if (p[0] <= p[2])

		cout << "Yes" << endl;

	else if (p[0] == p[2] + 1 && !p[1])

		cout << "Yes" << endl;

	else

		cout << "No" << endl;

	return 0;

}

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



const int max=100000+5;



int main(){

	int a[max]={0};

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

	

	scanf("%d",&n);

	

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

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

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

			four++;

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

			two++;

		else

			one++;

	} 

	

	if(two==0){

		if(four>=one-1)

			flag=1;

	}

	else{

		if(four>=one)

			flag=1;

	}

	

	if(flag==1)

		printf("Yes");

	else

		printf("No");

		

	return 0;

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

#include <iostream>

#include <cstring>

#include <cstdio>

#include <cmath>



using namespace std;



int main ()

{

	int n,a,b1=0,b2=0;

	scanf ("%d",&n);

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

	{

		scanf ("%d",&a);

		if (a%2==1) b1++;

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

	}

	if ((b2>=b1)||(b2+1==b1 && b2+b1==n)) 

		printf ("Yes\n");

	else printf ("No\n");

	return 0;

}


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



const int max=100000+5;



int main(){

	int a[max]={0};

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

	

	scanf("%d",&n);

	

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

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

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

			four++;

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

			two++;

		else

			one++;

	} 

	

	if(two==0){

		if(four>=one-1)

			flag=1;

	}

	else{

		if(four>=one)

			flag=1;

	}

	

	if(flag==1)

		printf("Yes");

	else

		printf("No");

		

	return 0;

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

using namespace std;



int main()

{

	int N;

	cin >> N;

	int x; int good = 0, bad = 0;

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

		cin >> x;

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

		else {

			if (x % 4 == 1 || x % 4 == 3)bad++;

		}

	}

	if (good >= bad)cout << "Yes";

	else {

		if (good == bad - 1) {

			if (good + bad == N)cout << "Yes";

			else cout << "No";

		}

		else cout << "No";

	}

    return 0;

}




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



const int max=100000+5;



int main(){

	int a[max]={0};

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

	

	scanf("%d",&n);

	

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

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

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

			four++;

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

			two++;

		else

			one++;

	} 

	

	if(two==0){

		if(four>=one-1)

			flag=1;

	}

	else{

		if(four>=one)

			flag=1;

	}

	

	if(flag==1)

		printf("Yes");

	else

		printf("No");

		

	return 0;

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

using namespace std;



int main()

{

    int n,x;

    int cnt=0,cnt2=0,cnt4=0;

    cin>>n;

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

    {

        cin>>x;

        if(x%4==0)

            cnt4++;

        else if(x%2==0)

            cnt2++;

    }

    cnt=n-cnt2-cnt4;

//    cout<<cnt<<" "<<cnt2<<" "<<cnt4<<endl;

    if(cnt2)

    {

        if(cnt4>=cnt)

            cout<<"Yes"<<endl;

        else

            cout<<"No"<<endl;

    }

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

        cout<<"Yes"<<endl;

    else

        cout<<"No"<<endl;

    return 0;

}


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

#define MAXN 100005



int main ()

{

	int n;

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

	{

		int n1 = 0, n2 = 0, n3 = 0;

		int a;

		while(n--)

		{

			scanf("%d", &a);

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

			else if(a%2 == 0)n2++;

			else n3++;

		}

		if((n3 - 1 > n1) || n3 - 1 == n1 && n2)

		printf("No\n");

		else printf("Yes\n");

	}

	return 0;

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

using namespace std;

int ara[1000000];

char ara1[1000000];

int main()

{

    int i,j,k,l,n,ln,t,df,v=0,sum,fl=0;

    long long gun=1;

    scanf("%d",&n);

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

    {

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

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

        {

            fl++;

        }

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

        {

            v++;

        }

    }

    v/=2;

    t=n/2;

    fl+=v;

    if(fl<t)

    {

        printf("No\n");

    }

    else

    {

        printf("Yes\n");

    }

    return 0;

}


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

#define MAXN 100005



int main ()

{

	int n;

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

	{

		int n1 = 0, n2 = 0, n3 = 0;

		int a;

		while(n--)

		{

			scanf("%d", &a);

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

			else if(a%2 == 0)n2++;

			else n3++;

		}

		if((n3 - 1 > n1) || n3 - 1 == n1 && n2)

		printf("No\n");

		else printf("Yes\n");

	}

	return 0;

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

#define N 100020

#define ll long long

using namespace std;

inline int read(){

	int x=0,f=1;char ch=getchar();

	while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());

	while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();

	return f?x:-x;

}

int cnt2, cnt4;

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

	int n = read();

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

		int x = read();

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

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

	}

	if (cnt4 * 2 + (cnt2 ? cnt2 : 1) >= n) puts("Yes");

	else puts("No");

	return 0;

}


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

#define MAXN 100005



int main ()

{

	int n;

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

	{

		int n1 = 0, n2 = 0, n3 = 0;

		int a;

		while(n--)

		{

			scanf("%d", &a);

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

			else if(a%2 == 0)n2++;

			else n3++;

		}

		if((n3 - 1 > n1) || n3 - 1 == n1 && n2)

		printf("No\n");

		else printf("Yes\n");

	}

	return 0;

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

#include <algorithm>

using namespace std;



const int N = 1e5 + 5;



int n, a[N], cc[N], p[5];



int main() {

	ios::sync_with_stdio(false);

	cin >> n;

	int cnt = 0;

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

		cin >> a[i];

		for (int t = a[i], cnt = 0; t % 2 == 0 && t; cc[i] = ++cnt, t /= 2)

			;

		cc[i] = min(cc[i], 2);

	}

	sort(cc + 1, cc + n + 1);

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

		++p[cc[i]];

	if (p[0] <= p[2])

		cout << "Yes" << endl;

	else if (p[0] == p[2] + 1 && !p[1])

		cout << "Yes" << endl;

	else

		cout << "No" << endl;

	return 0;

}

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

#define MAXN 100005



int main ()

{

	int n;

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

	{

		int n1 = 0, n2 = 0, n3 = 0;

		int a;

		while(n--)

		{

			scanf("%d", &a);

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

			else if(a%2 == 0)n2++;

			else n3++;

		}

		if((n3 - 1 > n1) || n3 - 1 == n1 && n2)

		printf("No\n");

		else printf("Yes\n");

	}

	return 0;

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

using namespace std;

int n;

int main()

{

	ios::sync_with_stdio(0);

	cin>>n;int a1=0,a2=0,a4=0;

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

		int x;cin>>x;

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

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

		else a1++;

	}

	if(a2==0&&a4>=a1-1)puts("Yes");

	else{

		if(a4>=a1)puts("Yes");

		else puts("No");

	}

	return 0;

}

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

#define MAXN 100005



int main ()

{

	int n;

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

	{

		int n1 = 0, n2 = 0, n3 = 0;

		int a;

		while(n--)

		{

			scanf("%d", &a);

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

			else if(a%2 == 0)n2++;

			else n3++;

		}

		if((n3 - 1 > n1) || n3 - 1 == n1 && n2)

		printf("No\n");

		else printf("Yes\n");

	}

	return 0;

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

using namespace std;

int n;

int main()

{

	cin>>n;int a1=0,a2=0,a4=0;

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

	{

		int x;cin>>x;

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

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

		else a1++;

	}

	if(a2==0&&a4>=a1-1)puts("Yes");

		else

		{

			if(a4>=a1)puts("Yes");

			else puts("No");

		}

	return 0;

}

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

#define MAXN 100005



int main ()

{

	int n;

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

	{

		int n1 = 0, n2 = 0, n3 = 0;

		int a;

		while(n--)

		{

			scanf("%d", &a);

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

			else if(a%2 == 0)n2++;

			else n3++;

		}

		if((n3 - 1 > n1) || n3 - 1 == n1 && n2)

		printf("No\n");

		else printf("Yes\n");

	}

	return 0;

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

#include<iostream>

#include<algorithm>

#include<math.h>

#include<stdlib.h>

#include<string.h>

#include<string>

#include<set>

#include<vector>

#include<bitset>

#include<map>

#define N 100005

#define ll long long

#define oo 100000000

#define For(i,x,y) for(int i=x;i<=y;i++)

#define Rep(i,x,y) for(int i=x;i>=y;i--)

#define Forn(i,x,y) for(int i=x;i<y;i++)

using namespace std;

inline int read(){int x=0,f=0;char ch=getchar();for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=1;for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-48;return f?-x:x;}

inline void write(ll x){if(x<10) putchar(x+48);else write(x/10),putchar(x%10+48);}

inline void writeln(ll x){if(x<0) putchar('-'),x=-x;write(x);putchar('\n');}

int n,a[N],p[4];

int main(){

	n=read();For(i,1,n) a[i]=read();

	For(i,1,n){

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

		else if(a[i]%2==0) p[1]++;

		else p[2]++;

	}

	if(p[1]==0){

		if(p[0]+1>=p[2]) puts("Yes");

		else puts("No");

	}else{

		if(p[0]>=p[2]) puts("Yes");

		else puts("No");

	}

	return 0;

}

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

#define MAXN 100005



int main ()

{

	int n;

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

	{

		int n1 = 0, n2 = 0, n3 = 0;

		int a;

		while(n--)

		{

			scanf("%d", &a);

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

			else if(a%2 == 0)n2++;

			else n3++;

		}

		if((n3 - 1 > n1) || n3 - 1 == n1 && n2)

		printf("No\n");

		else printf("Yes\n");

	}

	return 0;

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

using namespace std;



int main()

{

	int num, sequence,MOD1=0,MOD2=0,MOD4=0;

	cin >> num;

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

	{

		cin >> sequence;

		if (sequence % 4 == 0) MOD4++;

		else if (sequence % 2 == 0) MOD2++;

		else MOD1++;

	} 

	if (MOD1>MOD4 + 1 || (MOD1 == MOD4 + 1 && MOD2 != 0)) 

		cout<<"No"<<endl;

	else 

		cout<<"Yes"<<endl;

	

	return 0;

}


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

#define MAXN 100005



int main ()

{

	int n;

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

	{

		int n1 = 0, n2 = 0, n3 = 0;

		int a;

		while(n--)

		{

			scanf("%d", &a);

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

			else if(a%2 == 0)n2++;

			else n3++;

		}

		if((n3 - 1 > n1) || n3 - 1 == n1 && n2)

		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.425620368103621x):
#include <stdio.h>

#define MAXN 100005



int main ()

{

	int n;

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

	{

		int n1 = 0, n2 = 0, n3 = 0;

		int a;

		while(n--)

		{

			scanf("%d", &a);

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

			else if(a%2 == 0)n2++;

			else n3++;

		}

		if((n3 - 1 > n1) || n3 - 1 == n1 && n2)

		printf("No\n");

		else printf("Yes\n");

	}

	return 0;

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

#include<iostream>  

#include<stdio.h>  

#include<cmath>  

using namespace std;

int n, a[100005], b[5];

int main() 

{

	cin >> n;

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

		cin >> a[i];

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

	{

		if (a[i] & 1)

		{ 

			b[1]++; 

			continue;

		}

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

			b[4]++;

		else if 

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

	}

	if (!b[2] && b[1] > b[4] + 1)

	{

		printf("No");

		return 0;

	}

	if (b[2] && b[1] > b[4])

	{

		printf("No");

		return 0;

	}

	printf("Yes");

	return 0;

}

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

#define MAXN 100005



int main ()

{

	int n;

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

	{

		int n1 = 0, n2 = 0, n3 = 0;

		int a;

		while(n--)

		{

			scanf("%d", &a);

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

			else if(a%2 == 0)n2++;

			else n3++;

		}

		if((n3 - 1 > n1) || n3 - 1 == n1 && n2)

		printf("No\n");

		else printf("Yes\n");

	}

	return 0;

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

using namespace std;   

int a,b,c,x,n;

    int main()

    {

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

        {

            a=b=c=0;

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

            {

                scanf("%d",&x);

                if(!(x%4)) a++;

                else if(x&1) b++;

                else c++;

            }

            if(!c) b--;

            puts(a>=b?"Yes":"No");

        }

        return 0;

    }

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

#define MAXN 100005



int main ()

{

	int n;

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

	{

		int n1 = 0, n2 = 0, n3 = 0;

		int a;

		while(n--)

		{

			scanf("%d", &a);

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

			else if(a%2 == 0)n2++;

			else n3++;

		}

		if((n3 - 1 > n1) || n3 - 1 == n1 && n2)

		printf("No\n");

		else printf("Yes\n");

	}

	return 0;

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

#define loop(i,n) for(int i = 0;i < (n);i++)

#define range(i,a,b) for(int i = (a);i <= (b);i++)

#define all(A) A.begin(),A.end()

#define pb push_back

#define mp make_pair

#define sz(A) ((int)A.size())

#define vi vector<int>

#define vl vector<long long>

#define vd vector<double>

#define vp vector<pair<int,int> >

#define ll long long

#define pi pair<int,int>

#define popcnt(x) __builtin_popcount(x)

#define LSOne(x) ((x) & (-(x)))

#define xx first

#define yy second

#define PQ priority_queue

#define print(A,t) cerr << #A << ": "; copy(all(A),ostream_iterator<t>(cerr," " )); cerr << endl

#define prp(p) cerr << "(" << (p).first << " ," << (p).second << ")";

#define prArr(A,n,t)  cerr << #A << ": "; copy(A,A + n,ostream_iterator<t>(cerr," " )); cerr << endl

#define PRESTDIO() cin.tie(0),cerr.tie(0),ios_base::sync_with_stdio(0)

#define what_is(x) cerr << #x << " is " << x << endl

#define bit_lg(x) (assert(x > 0),__builtin_ffsll(x) - 1)

const double PI = acos(-1);

using namespace std;



int cnt[4];

int A[1 << 20];



int main(){

	int n,x; scanf("%d",&n);

	loop(i,n) {

		scanf("%d",&x);

		cnt[x%4]++;

	}

	memset(A,-1,sizeof A);

	for(int i = 1;i < n && cnt[0];i += 2,cnt[0]--)

		A[i] = 0;

	for(int i = 0;i < n && cnt[1] + cnt[3];i += 2)

		if(cnt[1]) A[i] = 1,cnt[1]--;

		else A[i] = 3,cnt[3]--;

	for(int i = n-1;i >= 0 && cnt[2];i--)

		if(A[i] == -1){

			A[i] = 2;

			cnt[2]--;

		}

	loop(i,n-1) if((A[i] * A[i+1])%4) {

		puts("No");

		return 0;

	}

	puts("Yes");

	return 0;

}


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

#define loop(i,n) for(int i = 0;i < (n);i++)

#define range(i,a,b) for(int i = (a);i <= (b);i++)

#define all(A) A.begin(),A.end()

#define pb push_back

#define mp make_pair

#define sz(A) ((int)A.size())

#define vi vector<int>

#define vl vector<long long>

#define vd vector<double>

#define vp vector<pair<int,int> >

#define ll long long

#define pi pair<int,int>

#define popcnt(x) __builtin_popcount(x)

#define LSOne(x) ((x) & (-(x)))

#define xx first

#define yy second

#define PQ priority_queue

#define print(A,t) cerr << #A << ": "; copy(all(A),ostream_iterator<t>(cerr," " )); cerr << endl

#define prp(p) cerr << "(" << (p).first << " ," << (p).second << ")";

#define prArr(A,n,t)  cerr << #A << ": "; copy(A,A + n,ostream_iterator<t>(cerr," " )); cerr << endl

#define PRESTDIO() cin.tie(0),cerr.tie(0),ios_base::sync_with_stdio(0)

#define what_is(x) cerr << #x << " is " << x << endl

#define bit_lg(x) (assert(x > 0),__builtin_ffsll(x) - 1)

const double PI = acos(-1);

using namespace std;

 

int cnt[4];

int A[1 << 20];

 

int main(){



	int n,x; scanf("%d",&n);

	loop(i,n) {

		scanf("%d",&x);

		cnt[x%4]++;

	}

	if(cnt[1] + cnt[2] + cnt[3] <= cnt[0] + 1) puts("Yes");

	else if(cnt[1] + cnt[3] <= cnt[0]) puts("Yes");

	else puts("No");

	return 0;

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

#include <cstring>

#include <iostream>

#include <string>

#include <cmath>

#include <bitset>

#include <vector>

#include <map>

#include <set>

#include <queue>

#include <deque>

#include <algorithm>

#include <complex>

#include <unordered_map>

#include <unordered_set>

#include <random>

#include <cassert>

#include <fstream>

#define popcount __builtin_popcount

using namespace std;

typedef long long int ll;

typedef pair<int, int> P;



int main()

{

    int n, m; cin>>n>>m;

    int q; cin>>q;

    int a[100010];

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

        cin>>a[i];

    }

    int ind[100010];

    fill(ind, ind+m+1, -1);

    int c=0;

    vector<int> v[100010];

    for(int i=q-1; i>=0; i--){

        if(ind[a[i]]==-1){

            ind[a[i]]=c;

            v[0].push_back(a[i]);

            c++;

        }else{

            int l=0, r=n;

            while(r-l>1){

                int mid=(l+r)/2;

                if(v[mid].size()<=ind[a[i]]) r=mid;

                else l=mid;

            }

            if(r<n && v[r].size()==ind[a[i]]){

                v[r].push_back(a[i]);

            }

        }

    }

    for(int i=1; i<=m; i++) if(ind[i]==-1) v[0].push_back(i);

    int mn=0;

    for(int i=m-1; i>=1; i--){

        if(v[0][i]<v[0][i-1]){

            mn=i; break;

        }

    }

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

        if(v[i].size()<mn){

            cout<<"No"<<endl; return 0;

        }

    }

    cout<<"Yes"<<endl;

    return 0;

}

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

#include <cstring>

#include <iostream>

#include <string>

#include <cmath>

#include <bitset>

#include <vector>

#include <map>

#include <set>

#include <queue>

#include <deque>

#include <algorithm>

#include <complex>

#include <unordered_map>

#include <unordered_set>

#include <random>

#include <cassert>

#include <fstream>

#define popcount __builtin_popcount

using namespace std;

typedef long long int ll;

typedef pair<int, int> P;



int main()

{

    int n, m; cin>>n>>m;

    int q; cin>>q;

    int a[100010];

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

        cin>>a[i];

    }

    int ind[100010];

    fill(ind, ind+m+1, -1);

    int cnt[100010]={};

    vector<int> v;

    for(int i=q-1; i>=0; i--){

        if(ind[a[i]]==-1){

            ind[a[i]]=cnt[0];

            v.push_back(a[i]);

            cnt[0]++;

        }else{

            int l=0, r=n;

            while(r-l>1){

                int mid=(l+r)/2;

                if(cnt[mid]<=ind[a[i]]) r=mid;

                else l=mid;

            }

            if(r<n && cnt[r]==ind[a[i]]) cnt[r]++;

        }

    }

    for(int i=1; i<=m; i++) if(ind[i]==-1) v.push_back(i);

    int mn=0;

    for(int i=m-1; i>=1; i--){

        if(v[i]<v[i-1]){

            mn=i; break;

        }

    }

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

        if(cnt[i]<mn){

            cout<<"No"<<endl; return 0;

        }

    }

    cout<<"Yes"<<endl;

    return 0;

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

#define si(a) scanf("%d",&a)

#define fore(i,a,b) for(int i=a;i<b;++i)

#define sorte(a) sort(a.begin(), a.end())

using namespace std;

typedef long long ll;

typedef vector<int> vi;

typedef pair<int,int> pi;

int main(){

	char s[5];

	scanf("%s",s);

	if(s[0]==s[1] || s[1]==s[2] ||s[2]==s[3])

		printf("Bad\n");

	else

		printf("Good\n");

	return 0;

}

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

int main()

{

	char a[4];

	scanf("%s",a);

	bool flag=1;

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

	{

		if(a[i]==a[i+1])

		{

			flag=0;

			break;

		}

	}

	if(flag)

	{

		printf("Good\n");

	}

	else

	{

		printf("Bad\n");

	}

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

#include <algorithm>

using namespace std;



int main()

{

	string s;

	while (cin >> s) {

		if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])

			cout << "Bad\n";

		else cout << "Good\n";

	}

}

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

int main()

{

	char a[4];

	scanf("%s",a);

	bool flag=1;

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

	{

		if(a[i]==a[i+1])

		{

			flag=0;

			break;

		}

	}

	if(flag)

	{

		printf("Good\n");

	}

	else

	{

		printf("Bad\n");

	}

}