stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n;

	cin>>n;

	int a[n];

	int t1=0,t2=0,t4=0;

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

	{

		int b;

		cin>>b;

		if(b%4==0)

		{

			a[i]=4;

			t4++;

		}

		else if(b%2==0)

		{

			a[i]=2;

			t2++;

		}

		else

		{

			a[i]=1;

			t1++;

		}

	}

	if(t4>=t1||(t2==0&&t4+1>=t1))

	{

		cout<<"Yes";

	}

	else

	{

		cout<<"No";

	}

	return 0;

}

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

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

}
// Slower C++ solution:
//soale C

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 20;

typedef long long ll;

ll n, a[N], c[10], d = 0;

int main(){

	cin >> n;

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

		cin >> a[i];

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

			a[i] = 2;

			c[0] += 1;

		}

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

			a[i] = 1;

			c[1] += 1;

		}

		else{

			a[i] = 0;

			c[2] += 1;

		}

	}

	if(c[1] != 0){

		if(c[2] > c[0]){

			d = 1;

		}

	}

	else{

		if(c[2] > c[0] + 1){

			d = 1;

		}

	}

	if(d == 1){

		cout << "No";

	}

	else{

		cout << "Yes";

	}

	return 0;

}

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

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

}
// 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.282801027586482x):
#include <cstdio>

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

}
// Slower C++ solution:
#define debug 0

#define test 0

#define CPLUS 1

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#include <math.h>

#include <string.h>

#if CPLUS

#include <iostream>

#include <stack>

#include <string>

#include<algorithm>

using namespace std;

#endif



int a[100005];





int check(int n1, int n2, int n4)

{

	if (n4 >= n1)

		return 1;

	else if (n1 == n4 + 1 && n2 == 0)

		return 1;

	else

		return 0;

}



int main(void)

{

#if debug

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

#endif

	int i, n;

	cin >> n;

	int n1=0, n2 = 0, n4 = 0;

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

		cin >> a[i];

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

			n4++;

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

			n2++;

		else

			n1++;

	}

#if test

	printf("%d %d %d", n1, n2, n4);

#endif

	if (check(n1, n2, n4))

		printf("Yes\n");

	else

		printf("No\n");

	return 0;

}

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

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

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

#include<string.h>

#include<stdlib.h>

#include<sstream>

#include<iostream>

#include<algorithm>

#include<math.h>

#include<vector>

#include<map> //要学会用map 

#include<queue>

#include<stack>

using namespace std;

/*如果a大于0且b大于0，但相加得到的却是小于等于0的说明是正溢出，这时肯定比c大（因为c肯定在long long的范围内）。

如果a小于0且b小于0，但相加得到的却是大于等于0的说明是负溢出，这是肯定比c小。*/

const int maxn = 10001;

int prime[maxn],pNum = 0;

bool p[maxn] = {0};

void Find_Prime()

{

	for(int i=2;i<maxn;i++)

	{

		if(p[i] ==false)

		{

			prime[pNum++]=i;

			for(int j=i+i;j<maxn;j+=i)

			{

				p[j] = true;

			}

		}

	}

}

int main(){

	int n;

	scanf("%d",&n);

	int count = 0;

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

	{

		int temp;

		scanf("%d",&temp);

		if(temp%4==0) count+=2;

		else if(temp%2==0) count+=1;

	}

	if(n%2==0)

	{

		if(count>=n) printf("Yes");

		else printf("No");

	}

	else

	{

		if(count>=n-1) printf("Yes");

		else printf("No");

	}

	return 0;	

}

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

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

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

#include <bits/stdc++.h>



#define MAXN 100000

/*

bool check1(int *a, int n);

bool check2(int *a, int n);



int main()

{

    int n, i, a[MAXN];

    scanf("%d", &n);

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

    {

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

    }

    if(check1(a, n) == false)

        printf("No");

    else

        printf("Yes");

}

bool check1(int * a, int n)

{

   int *p, i;

   if(check2(a, n) == false)

        return false;

    else

    {

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

        {

           *p = * (a + n);

           * (a + n) = * (a + i);

           * (a + i) = * p;

           if(check1(a, n-1) == false || a[n-2] * a[n-1] % 4 != 0)

              return false;

           *p = * (a + n);

           * (a + n) = * (a + i);

           * (a + i) = * p;

        }

    }

    return true;

}

bool check2(int * a, int n)

{

    int i;

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

    {

        if(a[i] * a[i-1] % 4 != 0 || a[i] * a[i+1] % 4 != 0)

            return false;

    }

    if(a[0] * a[1] % 4 != 0 )

        return false;

    return true;

}

*/

int main()

{

    int n, i, a[MAXN], a4 = 0, a2 = 0, a1 = 0;

    scanf("%d", &n);

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

    {

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

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

        a4++;

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

        a2++;

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

        a1++;

    }

    if(a4 >= a1)

    {

          printf("Yes\n");

    }

    else

    {

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

            printf("Yes\n");

        else

            printf("No\n");

    }

}




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

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

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

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

#include<math.h>

#include<algorithm>

#include<string>

#include<stack>

using namespace std;

typedef  long long LL;

const int maxn=505;

char tmp[maxn];

int dp[maxn][maxn];

int max(int a,int b)

{

    if(a<b)

        return b;

    return a;

}

/*LL gcd(LL a,LL b)

{

    if(b==0)

        return a;

    return gcd(b,a%b);

}

LL lcm(LL a,LL b)

{

    return a/gcd(a,b)*b;

}*/



int main()

{

     int n;

     cin>>n;

     int num_4=0;

     int num_2=0;

     int n2=n;

     while(n2--)

     {

         LL m;

         cin>>m;

         if(m%4==0)

            num_4++;

         else if(m%2==0)

         {

             num_2++;

         }



     }

     int sum=0;

     sum=num_4*2+1;

     if(sum>=n)

     {

          cout<<"Yes"<<endl;

     }

     else

     {  sum+=num_2;

     if(sum>n)

        cout<<"Yes"<<endl;

     else

        cout<<"No"<<endl;



     }





    return 0;

}


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

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

}
// Slower C++ solution:
//#define _CRT_SECURE_NO_WARNINGS

#define LOCAL_CHUNYU



//#include <iostream>

#include <cstdio>

#include <vector>

#include <algorithm>

#include <cstring>	//memset

#include <ctime>

//#include <cmath>





using std::vector;

using std::sort;

using std::swap;



typedef long long LL;

const int maxn = 1e5 + 10;

const int mod = 1e9 + 7;

const double eps = 1e-8;

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



#define equ(a,b) ((fabs((a)-(b))) < (eps))

#define gth(a,b) (((a)-(b)) > (eps))

#define lth(a,b) (((a)-(b)) < (-eps))

#define gequ(a,b) (((a)-(b)) > (-eps))

#define lequ(a,b) (((a)-(b)) < (eps))







int main() {

#ifdef LOCAL_CHUNYU

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

#endif // LOCAL_CHUNYU



//    int N;

//    scanf("%d",&N);

//    int *sample = new int[N];

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

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

//    }

//    sort(sample, sample + N);

//    int flag = 0;

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

//        int temp = i + 1;

//        int j;

//        for(j = temp; j < N; ++j){

//            if(sample[j] * sample[i] % 4 == 0){

//                if(j == temp)

//                    break;

//                else{

//                    swap(sample[temp], sample[j]);

//                    sort(sample + temp + 1, sample + N);

//                    break;

//                }

//

//            }

//

//        }

//        if(j == N){

//            flag = 1;

//            printf("No\n");

//            break;

//        }

//    }

//    if(flag == 0){

//        printf("Yes\n");

//    }



    int N;

    scanf("%d",&N);

    int *sample = new int[N];

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

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

    }

    int a4 = 0, a2 = 0, a1 = 0;

    int temp;

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

        temp = sample[i];

        if(temp % 4 == 0)

            a4++;

        if(temp % 2 == 0 && temp % 4 != 0)

            a2++;

        if(temp % 2 != 0)

            a1++;

    }

    if(a4 >= a1){

        printf("Yes\n");

        return 0;

    }

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

        printf("Yes\n");

        return 0;

    }

    printf("No\n");











	return 0;

}


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

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

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

#include<string>

#include<algorithm>

using namespace std;



int main()

{

	int n;

	cin>>n;

	int A=0,B=0,C=0,x;

	while(n--)

	{

		cin>>x;

		if(x%2==0&&x%4==0)A++;

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

		else C++;

	}

	if(A>=C)cout<<"Yes";

	else if(B==0&&C-A==1)cout<<"Yes";

	else cout<<"No";

	//system("pause");

}

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

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

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

#include <algorithm>

#include <cstdio>

#include <cstring>



using namespace std;



int ans[26];



int main(){

    int n;

    scanf("%d",&n);

    long long r1 = 0,r2 = 0;

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

        int k;

        scanf("%d",&k);

        if(k%4==0){

            r1++;

        }

        else if(k%2==0){

            r2++;

        }

    }

    if (n > r1*2+1+r2 ){

        printf("No");

    }

    else if (n == r1*2 + r2+1&&r2!=0){

        printf("No");

    }

    else{

        printf("Yes");

    }

}


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

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

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

using namespace std;



int main() {

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

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

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

		int k; scanf("%d", &k);

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

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

		else c1++;

	}

	if(c4 >= c1) puts("Yes");

	else {

		if(c4 + 1 == c1 && !c2) puts("Yes");

		else puts("No");

	}

	return 0;

}


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

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

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

using namespace std;

const int N = 100010;

int a[N];

int main(){

	ios::sync_with_stdio(0);

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

	int n; cin >> n;

	int cnt2 = 0, cnt4 = 0, cnt1 = 0;

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

		cin >> a[i];

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

			cnt2++;

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

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

	}

	if(cnt4 == 0){

		if(cnt1 == 0)

			cout << "Yes\n";

		else

			cout << "No\n";

	}

	else{

		if(cnt2 > 0){

			if(cnt1 <= cnt4)

				cout << "Yes\n";

			else

				cout << "No\n";

		}

		else{

			if(cnt1 <= cnt4 + 1)

				cout << "Yes\n";

			else

				cout << "No\n";

		}

	}

	return 0;

}

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

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

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

using namespace std;

typedef long long ll;

int main()

{

	int n;

	scanf("%d",&n);

	ll temp;

	int num3=0;

	int num2=0;

	int num1=0;

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

	{

		scanf("%lld",&temp);

		if(temp%4==0)

		{

			num1++;

		}

		else if(temp%2==0)

		{

			num2++;

		}

		else

		{

			num3++;

		}

	}

	if(num2)

	{

		num2=1;

	}

	if(num1>=(num2+num3-1))

	{

		printf("Yes\n");

	}

	else

	{

		printf("No\n");

	}

	return 0;

}

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

int main()

{

    int n, deal;

    int four = 0, two = 0, odd = 0;

    scanf("%d", &n);

    while (n--)

    {

        scanf("%d", &deal);

        if (deal % 4 == 0)

            four++;

        else if (deal % 2 == 0)

            two++;

        else

            odd++;

    }

    if (two == 0)

    {

        if (four >= odd - 1)

            printf("Yes");

        else

            printf("No");

    }

    else if (four >= odd)

        printf("Yes");

    else

        printf("No");

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

namespace chtholly{

typedef long long ll;

#define re0 register int

#define rec register char

#define rel register ll

#define gc getchar

#define pc putchar

#define p32 pc(' ')

#define pl puts("")

/*By Citrus*/

inline int read(){

  int x=0,f=1;char c=gc();

  for (;!isdigit(c);c=gc()) f^=c=='-';

  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');

  return f?x:-x;

  }

template <typename mitsuha>

inline bool read(mitsuha &x){

  x=0;int f=1;char c=gc();

  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';

  if (!~c) return 0;

  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');

  return x=f?x:-x,1;

  }

template <typename mitsuha>

inline int write(mitsuha x){

  if (!x) return 0&pc(48);

  if (x<0) x=-x,pc('-');

  int bit[20],i,p=0;

  for (;x;x/=10) bit[++p]=x%10;

  for (i=p;i;--i) pc(bit[i]+48);

  return 0;

  }

inline char fuhao(){

  char c=gc();

  for (;isspace(c);c=gc());

  return c;

  }

}using namespace chtholly;

using namespace std;

const int yuzu=1e5;

int cnt,cnt1,cnt2;

int main(){

int n=read();

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

  int x=read();

  if (!(x&1)){

    if (!(x>>1&1)){

      ++cnt1;

      }else{

      ++cnt2;

      }

    }

  }

if (cnt2/2+cnt1>=n/2) puts("Yes");

else puts("No");

}

// Faster C++ solution for the same problem (measured speedup: 5.214430226006078x):
#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++; //是4的倍数，可以放在任何数旁边构成幸运数列

        else if (x % 2 == 0)

            a2count++; //不是4但是2的倍数，要么放在a4旁边，要么放在a2 自己旁边

        else

            a1count++;//不是2的倍数，也不是4的倍数，就是其他数字，必须放在a4旁边

    }

    //先让a1与a4交替出现，a1的个数只能比a4的个数最多多一个，最好小于a4的个数

    if (a2count > 0 && a1count <= a4count) //类似 a1,a4,a1,a4,a2,a2,a2...

        printf("Yes\n");

    else if (a2count == 0 && a1count <= a4count + 1)//类似 a1,a4,a1 

        printf("Yes\n");

    else

        printf("No\n");



    return 0;

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

using namespace std;

int main()

{

	int n;

	cin>>n;

	int a[n];

	int t1=0,t2=0,t4=0;

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

	{

		int b;

		cin>>b;

		if(b%4==0)

		{

			a[i]=4;

			t4++;

		}

		else if(b%2==0)

		{

			a[i]=2;

			t2++;

		}

		else

		{

			a[i]=1;

			t1++;

		}

	}

	if(t4>=t1||(t2==0&&t4+1>=t1))

	{

		cout<<"Yes";

	}

	else

	{

		cout<<"No";

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2898821620164505x):
#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++; //是4的倍数，可以放在任何数旁边构成幸运数列

        else if (x % 2 == 0)

            a2count++; //不是4但是2的倍数，要么放在a4旁边，要么放在a2 自己旁边

        else

            a1count++;//不是2的倍数，也不是4的倍数，就是其他数字，必须放在a4旁边

    }

    //先让a1与a4交替出现，a1的个数只能比a4的个数最多多一个，最好小于a4的个数

    if (a2count > 0 && a1count <= a4count) //类似 a1,a4,a1,a4,a2,a2,a2...

        printf("Yes\n");

    else if (a2count == 0 && a1count <= a4count + 1)//类似 a1,a4,a1 

        printf("Yes\n");

    else

        printf("No\n");



    return 0;

}
// Slower C++ solution:
//soale C

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 20;

typedef long long ll;

ll n, a[N], c[10], d = 0;

int main(){

	cin >> n;

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

		cin >> a[i];

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

			a[i] = 2;

			c[0] += 1;

		}

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

			a[i] = 1;

			c[1] += 1;

		}

		else{

			a[i] = 0;

			c[2] += 1;

		}

	}

	if(c[1] != 0){

		if(c[2] > c[0]){

			d = 1;

		}

	}

	else{

		if(c[2] > c[0] + 1){

			d = 1;

		}

	}

	if(d == 1){

		cout << "No";

	}

	else{

		cout << "Yes";

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.289693956523152x):
#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++; //是4的倍数，可以放在任何数旁边构成幸运数列

        else if (x % 2 == 0)

            a2count++; //不是4但是2的倍数，要么放在a4旁边，要么放在a2 自己旁边

        else

            a1count++;//不是2的倍数，也不是4的倍数，就是其他数字，必须放在a4旁边

    }

    //先让a1与a4交替出现，a1的个数只能比a4的个数最多多一个，最好小于a4的个数

    if (a2count > 0 && a1count <= a4count) //类似 a1,a4,a1,a4,a2,a2,a2...

        printf("Yes\n");

    else if (a2count == 0 && a1count <= a4count + 1)//类似 a1,a4,a1 

        printf("Yes\n");

    else

        printf("No\n");



    return 0;

}