stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#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;







}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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 的倍数都被包起来了。*/




// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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";

    }

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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';

	}

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define ll long long

ll arr[200009];

int main()

{

    ll n,t,m,x,i,j,k,maxi = INT_MIN,mini = INT_MAX,flag =0,sum=0,sum1=0;

    vector<ll>vi;

    cin>>n;

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

    {

        cin>>x;

        if(x% 4==0)

            sum++;

        else if(x%4 == 2)

            sum1++;

    }

    n--;

    if(sum1>0){

            sum1--;

    n-=sum1;

    }

    n-=sum*2;

   // cout<<n<<endl;

    if(n<=0)

        cout<<"Yes"<<endl;

    else

        cout<<"No"<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<ctype.h>

#include<cmath>

#include<queue>

#define MAXN 10001



using namespace std;

typedef long long ll;



int main()

{

    int n;

    scanf("%d",&n);

    int a[n];

    int ct_2=0,ct_4=0;

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

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

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

            ct_4++;

        else{

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

                ct_2++;

        }

    }

    if(ct_2>=2)

        n-=ct_2-1;

    if(n<=(3+(ct_4-1)*2)&&ct_4>=1||n==1)

        printf("Yes\n");

    else printf("No\n");

    return 0;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

    int n,i,j=0,s=0,m=0;

    cin>>n;

    int a[n];

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

    {   cin>>a[i];

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

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

        else m++;

    }

    if(j>=m||(j-m==-1)&&s==0) cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

//long long

const int len = 1e5 + 5;

int a[len],cnt[5],N;



int main(void)

{

	scanf("%d", &N);

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

	{

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

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

			++cnt[4];

		else if (!(a[i] & 01))

			++cnt[2];

		else

			++ cnt[1];

	}

	if (cnt[2] == 0 && cnt[4] >= cnt[1] - 1)

		printf("Yes");

	else if (cnt[4] >= cnt[1])

		printf("Yes");

	else

		printf("No");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define LL long long

using namespace std;



#define maxn 10007

const int INF=0x3f3f3f3f;





int main()

{

    int a,b,c;

    a=b=c=0;

    int n,i,j,k,x,y;

    scanf("%d",&n);

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

    {

        scanf("%d",&x);

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

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

        else a++;

    }

    if(c>=a)

    {

        printf("Yes\n");

        return 0;

    }

    if(c==a-1&&b==0)

    {

        printf("Yes\n");

        return 0;

    }

    printf("No\n");



    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

//long long

const int len = 1e5 + 5;

int a[len],cnt[5],N;



int main(void)

{

	scanf("%d", &N);

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

	{

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

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

			++cnt[4];

		else if (!(a[i] & 01))

			++cnt[2];

		else

			++ cnt[1];

	}

	if (cnt[2] == 0 && cnt[4] >= cnt[1] - 1)

		printf("Yes");

	else if (cnt[4] >= cnt[1])

		printf("Yes");

	else

		printf("No");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main(){

	int a,b,x=0,y=0,cnt,i;

	cin>>a;

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

		cin>>b;

		cnt=0;

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

		if(b%2==0)cnt++;

		if(cnt==1)x++;

		if(cnt==2)y++;

	}

	if(y>=a-x-y)cout<<"Yes";

	else if(!x&&y==a/2)cout<<"Yes";

	else cout<<"No";

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

//long long

const int len = 1e5 + 5;

int a[len],cnt[5],N;



int main(void)

{

	scanf("%d", &N);

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

	{

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

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

			++cnt[4];

		else if (!(a[i] & 01))

			++cnt[2];

		else

			++ cnt[1];

	}

	if (cnt[2] == 0 && cnt[4] >= cnt[1] - 1)

		printf("Yes");

	else if (cnt[4] >= cnt[1])

		printf("Yes");

	else

		printf("No");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <stdio.h>

#include <stdlib.h>

#include <iostream>

#include <algorithm>

#include <cmath>

#include <cstring>

#include <map>

#include <vector>



using namespace std;



int A[110000];

int cnt1=0;

int cnt2=0;



int main()

{

    int n;

    scanf("%d",&n);

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

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

    

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

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

            cnt1++;

        }

        if(A[i]%2==1)

            cnt2++;

    }

    if(cnt1>=n/2 || cnt1>=cnt2){

        printf("Yes\n");

    }else{

        printf("No\n");

    }



    return 0;

}




// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

//long long

const int len = 1e5 + 5;

int a[len],cnt[5],N;



int main(void)

{

	scanf("%d", &N);

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

	{

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

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

			++cnt[4];

		else if (!(a[i] & 01))

			++cnt[2];

		else

			++ cnt[1];

	}

	if (cnt[2] == 0 && cnt[4] >= cnt[1] - 1)

		printf("Yes");

	else if (cnt[4] >= cnt[1])

		printf("Yes");

	else

		printf("No");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



#define pb push_back

#define ff first

#define ss second



typedef long long ll;

const ll MAXN = 2e6 + 10, inf = 1e18, mod = 1e9 + 7;



struct pair_hash {

	template <class T1, class T2>

	std::size_t operator () (const std::pair<T1,T2> &p) const {

		auto h1 = std::hash<T1>{}(p.first);

		auto h2 = std::hash<T2>{}(p.second);



		return h1 ^ h2;  

	}

};



ll pw(ll te, ll tee) {

	if (tee == 0)	return 1;

	ll res = pw(te, tee / 2);

	return (tee % 2 ? te * res * res : res * res);

}



ll n, a[MAXN], t, k, p;



void Read_input() {

	cin >> n;

	for (ll i = 1; i <= n; i++)	cin >> a[i];

}



void Solve() {

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

		if (a[i] % 2)	t++;

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

		else	p++;

	}

	if (k >= t or (p == 0 and k >= t - 1))	cout << "Yes";

	else	cout << "No";

}





int main() {



	ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0);

	//freopen("input.txt", "r", stdin),	freopen("output.txt", "w", stdout);



	Read_input(),	Solve();

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

//long long

const int len = 1e5 + 5;

int a[len],cnt[5],N;



int main(void)

{

	scanf("%d", &N);

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

	{

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

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

			++cnt[4];

		else if (!(a[i] & 01))

			++cnt[2];

		else

			++ cnt[1];

	}

	if (cnt[2] == 0 && cnt[4] >= cnt[1] - 1)

		printf("Yes");

	else if (cnt[4] >= cnt[1])

		printf("Yes");

	else

		printf("No");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//KING NIKAN

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;

int a[100010] ;

int main() 

{

	ios::sync_with_stdio(false) ;

	cin.tie(0) ;

	cout.tie(0) ;

	int n ;

	cin >> n ;

	int cnt_4=0 ,cnt_2=0 ,cnt_1=0 ;

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

	{

		cin >> a[i] ;

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

		{

			cnt_4++ ;

		}

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

		{

			cnt_2++ ;

		}

		else

		{

			cnt_1++ ;

		}

	}

	if(cnt_1>cnt_4+1)

	{

		cout << "No" ;

		return 0 ;

	}

	if(cnt_1==cnt_4+1 && cnt_2>0)

	{

		cout << "No" ;

		return 0 ;

	}

	cout << "Yes" ;

	return 0 ;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

//long long

const int len = 1e5 + 5;

int a[len],cnt[5],N;



int main(void)

{

	scanf("%d", &N);

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

	{

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

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

			++cnt[4];

		else if (!(a[i] & 01))

			++cnt[2];

		else

			++ cnt[1];

	}

	if (cnt[2] == 0 && cnt[4] >= cnt[1] - 1)

		printf("Yes");

	else if (cnt[4] >= cnt[1])

		printf("Yes");

	else

		printf("No");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main()

{

	int n;

	cin >> n;

	int a = 0, b = 0;

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

	{

		int x;

		cin >> x;

		if(x % 4 == 2)

		{

			a ++;

		}

		if(x % 4 == 0)

		{

			b ++;

		}

	}

	if(a + b * 2 >= n || b * 2 == n - 1)

	{

		cout << "Yes";

	}

	else

	{

		cout << "No";

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

//long long

const int len = 1e5 + 5;

int a[len],cnt[5],N;



int main(void)

{

	scanf("%d", &N);

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

	{

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

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

			++cnt[4];

		else if (!(a[i] & 01))

			++cnt[2];

		else

			++ cnt[1];

	}

	if (cnt[2] == 0 && cnt[4] >= cnt[1] - 1)

		printf("Yes");

	else if (cnt[4] >= cnt[1])

		printf("Yes");

	else

		printf("No");

	return 0;

}

// Fastest known solution for this problem: