stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<string>

#include<vector>

#include<queue>

#include<cmath>

#include<algorithm>

#include<iomanip>

#include<functional>

#include<set>

#include<map>

#include<utility>

#define ul unsigned long long int

#define ll long long int

#define MAX 1000000+1

using namespace std;

#define F first

#define S second

#define pi 2*acos(0.0)

#define PB push_back

#define Pp push

#define LSTAGE 1

int arr[200010];

ll bfs(vector<int> a[])

{

    queue<int>v;

    v.push(1);

    int t;

    arr[1] = 0;

    int x;

    while(v.size())

    {

        t = v.front();

        v.pop();

        if(arr[t]==2)

            return 1;

        for(int i= 0; i < a[t].size(); i++)

        {

            x = a[t][i];

            if(arr[x]==-1)

            {

                v.push(x);

                arr[x] = arr[t]+1;



            }

        }



    }

    return 0;



}





int main()

{

    ll n, r, t, f, s;

    t = f = s = 0;

    cin >> n;

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

    {

        cin >> r;

        if(r%4==0)

            f++;

        else if(r%4==2)

            t++;

        else

            s++;

    }

    n--;

    if(t)

        t--;





    n -= t;

    n -= f*2;

    if(n <= 0)



        cout <<"Yes";

    else

        cout << "No";





    return 0;

}


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

}

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

#include<cstdio>

#include<string>

#include<vector>

#include<queue>

#include<cmath>

#include<algorithm>

#include<iomanip>

#include<functional>

#include<set>

#include<map>

#include<utility>

#define ul unsigned long long int

#define ll long long int

#define MAX 1000000+1

using namespace std;

#define F first

#define S second

#define pi 2*acos(0.0)

#define PB push_back

#define Pp push

#define LSTAGE 1

int arr[200010];

ll bfs(vector<int> a[])

{

    queue<int>v;

    v.push(1);

    int t;

    arr[1] = 0;

    int x;

    while(v.size())

    {

        t = v.front();

        v.pop();

        if(arr[t]==2)

            return 1;

        for(int i= 0; i < a[t].size(); i++)

        {

            x = a[t][i];

            if(arr[x]==-1)

            {

                v.push(x);

                arr[x] = arr[t]+1;



            }

        }



    }

    return 0;



}





int main()

{

    ll n, r, t, f, s;

    t = f = s = 0;

    cin >> n;

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

    {

        cin >> r;

        if(r%4==0)

            f++;

        else if(r%2==0)

            t++;

        else

            s++;

    }

    if(t)

        s++;

    if((f+s)/2 <= f)

        cout <<"Yes";

    else

        cout << "No";





    return 0;

}


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

}

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

using namespace std;

int main(){

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

	cin>>n;

	while(n--){

		int temp;

		cin>>temp;

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

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

		else a1++;

	}

	if(a2==0){

		if(a4+1>=a1) cout<<"Yes";

		else cout<<"No";

	}else {

		if(a4>=a1) cout<<"Yes";

		else cout<<"No";

	}

	return 0;

}


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

}

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

//#include<algorithm>

using namespace std;

int main()

{

    int n, num_2 = 0, num_4 = 0, num_not24 = 0, tmp;

    bool is_luck;

    scanf("%d", &n);

    while(n--)

    {

        scanf("%d", &tmp);

        if(tmp % 4 == 0)

            num_4++;

        else if(tmp % 2 == 0)

            num_2++;

        else

            num_not24++;

    }

    if(num_2 != 0)

    {

        if(num_4 >= num_not24)

            is_luck = true;

        else

            is_luck = false;

    }

    else

    {

        if(num_4 >= num_not24 - 1)

            is_luck = true;

        else

            is_luck = false;

    }

    if(is_luck)

        printf("Yes\n");

    else

        printf("No\n");

    return 0;

}


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

}

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

#include<string>

using namespace std;

int d,t,n,s;



int main()

{

	d=0;t=0;cin>>n;

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

	{

		cin>>s;

		if(s%4==0)t++;

		else if(s%2==0)d++;

	}

	if(2*t+d>=n)cout<<"Yes";

	else if(d==0&&2*t+1>=n)cout<<"Yes";

	else cout<<"No";

}

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

}

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

#include<vector>

#define MAXN 100001



using namespace std;



int a[MAXN];



int main()

{

    int N;

    scanf("%d",&N);

    int count2=0,count4=0;

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

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

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

            count2++;

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

            count4++;

    }

    if((3+(count4-1)*2)>=(N-(count2/2*2)))

        printf("Yes\n");

    else

        printf("No\n");

    return 0;

}

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

}

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

using namespace std;

 







int main() {

 



  int n;

  cin>>n;



  vector<int> a(n);

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

    cin>>a.at(i);

  }



  int cnt4=0,cnt2=0;

  //4の倍数

  //4の倍数出ないが、2の倍数/2

  //の合計がn/2より大きい

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

    if(a.at(i)%4==0)

      cnt4++;

    else if(a.at(i)%2==0)

      cnt2++;

  }



  if(cnt4+cnt2/2>=n/2)

    cout<<"Yes"<<endl;

  else 

    cout<<"No"<<endl;



	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>





int main() {

 



  int n;

  scanf("%d",&n);



  int cnt4=0,cnt2=0;

  //4の倍数

  //4の倍数出ないが、2の倍数/2

  //の合計がn/2より大きい

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

    int wk;

    scanf("%d",&wk);

    if(wk%4==0)

      cnt4++;

    else if(wk%2==0)

      cnt2++;

  }



  if(cnt4+cnt2/2>=n/2)

    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;

  cin>>n;



  int cnt4=0,cnt2=0;

  //4の倍数

  //4の倍数出ないが、2の倍数/2

  //の合計がn/2より大きい

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

    int wk;

    cin>>wk;

    if(wk%4==0)

      cnt4++;

    else if(wk%2==0)

      cnt2++;

  }



  if(cnt4+cnt2/2>=n/2)

    cout<<"Yes"<<endl;

  else 

    cout<<"No"<<endl;



	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>





int main() {

 



  int n;

  scanf("%d",&n);



  int cnt4=0,cnt2=0;

  //4の倍数

  //4の倍数出ないが、2の倍数/2

  //の合計がn/2より大きい

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

    int wk;

    scanf("%d",&wk);

    if(wk%4==0)

      cnt4++;

    else if(wk%2==0)

      cnt2++;

  }



  if(cnt4+cnt2/2>=n/2)

    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,odd=0,even=0,four=0;

    scanf("%d",&n);

    int a[n+10];

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

    {

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

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

        {

            four++;

        }

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

        {

            even++;

        }

        else

        {

            odd++;

        }

    }

   if(odd>four)

   {

       int x=odd-four;

       if(x==1&&(2*four+x)==n)

       {

           printf("Yes");

       }

       else

       {

           printf("No");

       }



   }

   else

   {

       printf("Yes");

   }

   return 0;

}


// 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<iostream>

using namespace std;

int main()

{

	int i,N,count2=0,count4=0,countodd=0;

	cin>>N;

	long long ara[N];

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

		cin>>ara[i];

	}

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

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

			count2++;

		}

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

			count4++;

		}

		if(ara[i]%2!=0){

			countodd++;

		}

	}

	if(count2+count4==N){

		cout<<"Yes";

		return 0;

	}

	if(count4>=countodd&&count2>=2){

		cout<<"Yes";

		return 0;

	}

	else{

		if(count4>=N/2){

			cout<<"Yes";

		}

		else{

			cout<<"No";

		}

	}

	return 0;

}

// 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 cnt , cnt4 , cnt2 ;

int main()

{

	int n ;

	cin >> n ;

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

	{

		int x ;

		cin >> x ;

		x = x % 4 ;

		if ( x == 0 ) 

			cnt4 ++  ;

		else if ( x == 2 ) 

			cnt2 ++ ;

	}

	int cnt = n-cnt2-cnt4 ;

	if ( cnt2 ) 

	{

		if ( cnt4 >= cnt ) 

			return cout<<"Yes\n" , 0 ;



	}

	else

	{

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

			return cout << "Yes\n" , 0 ;



	}

	cout << "No" << "\n" ;

}

// 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 <iostream>

#include <algorithm>

#include <cstring>

#include <stdio.h>

#include <cstring>

#include <string.h>

using namespace std;



int main()

{

		int n;

		cin >> n;

		int four = 0, two = 0;

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

		{

			int x;

			cin >> x;

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

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

		}

		two = max(two - 1, 0);

		if (four * 2 + two >= n - 1)

			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):
//AZ@RK2019

//I know it wll accepted in first go! 

#include <bits/stdc++.h>

#include <iostream>

#include <set>

#include <vector>

#include <map>

#include <queue>

#include <algorithm>

using namespace std;

const int N = 2e5+7;

int n,a,one,two,four;

int main(){

	cin >> n;

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

		cin >> a; 

		if (a%4 == 0){

			four++;

		}

		else if(a%2 == 0){

			two++;

		}

		else{

			one++;

		}

	}

	if(four == one-1){

		if(two){

			cout << "No";

		}

		else{

			cout << "Yes";

		}

	}

	else if(four >= one){

		cout << "Yes";

	}

	else{

		cout << "No";

	}

	

	return 0;

}

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

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;

}

// 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//？？？？？？？？？？？？？？？ 

		{

			if( 2 * mod4 + mod2 < n )

				cout<<"No";

			else

				cout<<"Yes";

		}

	}



	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 <iostream>

#include <cstdio>

#include <algorithm>

#include <math.h>

using namespace std;



int main()

{

    int num, oddCount = 0, times4 = 0, times2 = 0, tmp;

    cin >> num;

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

        cin >> tmp;

        if(tmp & 1) ++oddCount;

        else if(tmp % 4 == 0) ++times4;

        else if(tmp % 2 == 0) ++times2;

    }

    if(times4 >= oddCount) cout << "Yes" << endl;

    else if(times4 + 1 >= oddCount && times2 == 0) cout << "Yes" << endl;

    else cout << "No" << endl;

	return 0;

}


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

	}//得出3类数字的个数 

	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>

int main(){

int a=0,b=0,i,j,k,n;

scanf("%d",&n);

for(i=1;i<=n;i++){scanf("%d",&k);

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

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

}

if((a*2+1>=n)||(a*2+b>=n))printf("Yes");

else printf("No");

return 0;

}




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

#include<cstring>

#include<algorithm>

#include<cmath>



using namespace std;

int cnt4,cnt2,n;

int a;



int main()

{

    scanf("%d",&n);

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

    {

        scanf("%d",&a);

        if(a%4==0)

            cnt4++;

            else if(a%2==0)

                cnt2++;

    }

    if(cnt2+cnt4*2<n-1)

        printf("No\n");

        else if(cnt4*2+cnt2==n-1&&cnt2!=0)

            printf("No\n");

            else

                printf("Yes\n");

    return 0;

}

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

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>

#include<algorithm>

#include<cmath>



using namespace std;

int cnt4,cnt2,n;

int a;



int main()

{

    scanf("%d",&n);

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

    {

        scanf("%d",&a);

        if(a%4==0)

            cnt4++;

            else if(a%2==0)

                cnt2++;

    }

    if(cnt2+cnt4*2<n-1)

        printf("No\n");

        else if(cnt4*2+cnt2==n-1&&cnt2!=0)

            printf("No\n");

            else

                printf("Yes\n");

    return 0;

}

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

#include<algorithm>

using namespace std;

int main()

{

    int a=0,b=0,c=0;//a 4 ;b 2;c others

    int n;

    cin>>n;

    while(n--){

    	int tmp;

    	cin>>tmp;

    	if(tmp%4==0)

    		a++;

		else if(tmp%2==0)

			b++;

		else

			c++;

	}

	if(c==0&&a==0){

		if(b==1)

			cout<<"No"<<endl;

		else	

			cout<<"Yes"<<endl;

		return 0;

	}

	if(b!=0)

		c++;

	if(a==0&&c!=0)

		cout<<"No"<<endl;

	else if(c<=a+1)

		cout<<"Yes"<<endl;

	else

		cout<<"No"<<endl;

    return 0;

}

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

#include<cstring>

#include<algorithm>

#include<cmath>



using namespace std;

int cnt4,cnt2,n;

int a;



int main()

{

    scanf("%d",&n);

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

    {

        scanf("%d",&a);

        if(a%4==0)

            cnt4++;

            else if(a%2==0)

                cnt2++;

    }

    if(cnt2+cnt4*2<n-1)

        printf("No\n");

        else if(cnt4*2+cnt2==n-1&&cnt2!=0)

            printf("No\n");

            else

                printf("Yes\n");

    return 0;

}

// Fastest known solution for this problem: