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

int main(){

	int counta=0,countb=0,countc=0;

	int N;int num[100000];

	scanf("%d",&N);

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

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

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

			counta++;

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

			countb++;

		else

			countc++;

	}

	if(counta==countc-1&&counta+countc==N)

		printf("Yes\n");

	else if(counta>=countc)

		printf("Yes\n");

	else

		printf("No\n");

	return 0;

	

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

int main(){

	int counta=0,countb=0,countc=0;

	int N;int num[100000];

	scanf("%d",&N);

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

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

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

			counta++;

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

			countb++;

		else

			countc++;

	}

	if(counta==countc-1&&counta+countc==N)

		printf("Yes\n");

	else if(counta>=countc)

		printf("Yes\n");

	else

		printf("No\n");

	return 0;

	

}
// 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++;

		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;

}
// 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++;

		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;

}
// 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++;

		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;

}
// 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.28259102784422x):
#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;

}
// 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.2781134428846395x):
#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;

}
// 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.231373337103439x):
#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;

}
// 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.312885157235827x):
#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;

}
// 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.315412845747401x):
#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;

}
// 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.858519083581346x):
#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;

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

int main(){

	int n,a;

	int count1=0,count2=0,count4=0;

	scanf("%d",&n);

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

		scanf("%d",&a);

		if(a%2==0&&a%4!=0) count2++;

		else if(a%4==0) count4++;

		else count1++;

	}

	if(count2>0&&count4>=count1) printf("Yes");

	else if(count2==0&&count4>=count1-1) printf("Yes");

	else printf("No");

	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.288989885990778x):
#include<cstdio>

int main(){

	int n,a;

	int count1=0,count2=0,count4=0;

	scanf("%d",&n);

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

		scanf("%d",&a);

		if(a%2==0&&a%4!=0) count2++;

		else if(a%4==0) count4++;

		else count1++;

	}

	if(count2>0&&count4>=count1) printf("Yes");

	else if(count2==0&&count4>=count1-1) printf("Yes");

	else printf("No");

	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.288801712243225x):
#include<cstdio>

int main(){

	int n,a;

	int count1=0,count2=0,count4=0;

	scanf("%d",&n);

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

		scanf("%d",&a);

		if(a%2==0&&a%4!=0) count2++;

		else if(a%4==0) count4++;

		else count1++;

	}

	if(count2>0&&count4>=count1) printf("Yes");

	else if(count2==0&&count4>=count1-1) printf("Yes");

	else printf("No");

	return 0;

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



using namespace std;

typedef pair <int, int> pii;



const int maxn = 100001;



int n,a,q,w,e,s;



void input();

void solve();



int main(){

	input();

	solve();

	

	return 0;

}

void input(){

	cin>>n;

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

		cin>>a;

		if (a%4==0){

			q++;

		}

		else{

			if (a%2==0){

				w++;

			}

			else{

				e++;

			}

		}

		s++;

	}

	

}

void solve(){

	if (w>0){

		e++;

	}

	while(q>=2 and e>=2){

		q-=2;

		e-=2;

	}

	e--;

	if (e>q){

		cout<<"No";

	}

	else{

		cout<<"Yes";

	}

}

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

int main(){

	int n,a;

	int count1=0,count2=0,count4=0;

	scanf("%d",&n);

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

		scanf("%d",&a);

		if(a%2==0&&a%4!=0) count2++;

		else if(a%4==0) count4++;

		else count1++;

	}

	if(count2>0&&count4>=count1) printf("Yes");

	else if(count2==0&&count4>=count1-1) printf("Yes");

	else printf("No");

	return 0;

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

int main(){

	int n,a;

	int count1=0,count2=0,count4=0;

	scanf("%d",&n);

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

		scanf("%d",&a);

		if(a%2==0&&a%4!=0) count2++;

		else if(a%4==0) count4++;

		else count1++;

	}

	if(count2>0&&count4>=count1) printf("Yes");

	else if(count2==0&&count4>=count1-1) printf("Yes");

	else printf("No");

	return 0;

}