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

using namespace std;



int n,a[100010],sum1,sum2,cnt1,cnt2;



int main()

{

	cin>>n;

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

	{

		cin>>a[i];

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

		if(a[i]%4==1||a[i]%4==3) sum2++;

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

		if(a[i]==2) cnt2++;

		

	}

	sum1+=cnt2/2;

	if(sum1+1>=sum2+min(1,cnt1)) cout<<"Yes"; else cout<<"No";

	

	return 0;

}

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



int n;

int x, y, z;

int a[100005];



int main()

{

	while (~scanf("%d", &n))

	{

		x = y = z = 0;

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

		{

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

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

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

			else z++;

		}



		/*printf("x = %d\n", x);

		printf("y = %d\n", y);

		printf("z = %d\n", z);*/



		if (y % 2)

		{

			if (x + 1>= 1 + z)

			{

				printf("Yes\n");

				continue;

			}

		}



		else if (y % 2 == 0)

		{

			if (x + 1>= z)

			{

				printf("Yes\n");

				continue;

			}

		}



		printf("No\n");

	}

	return 0;

}
// Slower C++ solution:
/*

×¢Òâ·¶Î§£¡

short·¶Î§£º-32768~32767

unsigned short·¶Î§£º0~65535

int·¶Î§£º-2147483648~2147483647

uint·¶Î§£º0~4294967295

INT·¶Î§£º-9223372036854775808~9223372036854775807

UINT·¶Î§£º0~18446744073709551615

float·¶Î§£º-3.4e38~3.4e38£¬¾«¶È£º6~7Î»

double·¶Î§£º-1.7e308~1.7e308£¬¾«¶È£º15~16Î»

ldouble·¶Î§£º-1.2e4932~1.2e4932£¬¾«¶È£º18~19Î»

*/

#include <algorithm>

#include <bitset>

#include <cassert>

#include <cctype>

#include <cmath>

#include <complex>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <ctime>

#include <deque>

#include <fstream>

#include <functional>

#include <iomanip>

#include <iostream>

#include <list>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <string>

#include <utility>

#include <vector>

#define LL long long

#define pb push_back

#define pob pop_back

#define mp make_pair

#define FILL(a,v) memset((void*)a,v,sizeof(a))

#define FILL0(a) FILL(a,0)

#define FILL1(a) FILL(a,-1)

#define ALL(a) (a).begin(),(a).end()

#define Inf 1e9

#define Mod 1000000007

#define foreach(it,x) for(typeof(x.begin()) it=x.begin();it!=x.end();it++)

#define FOR(i,x) for(int i=0;i<x;i++)

#define RFOR(i,x) for(int i=x-1;i>=0;i--)

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

#define FRFOR(i,a,b) for(int i=a-1;i>=b;i--)

#define SZ(a) ((int)(a).size())

#define FI first

#define SE second

#define OVER(a) return puts(a),0

#define fastio ios::sync_with_stdio(0)

#define filei(f) freopen(f,"r",stdin)

#define fileo(f) freopen(f,"w",stdout)

using namespace std;

typedef pair<int,int> pii;

typedef unsigned long long UINT;

typedef unsigned int Uint;

typedef long long INT;

typedef pair<INT,INT> PII;

typedef vector<int> vint;

typedef vector<INT> VINT;

typedef vector<pii> vpii;

typedef vector<PII> VPII;

typedef greater<int> gint;

typedef greater<INT> GINT;

typedef greater<pii> gpii;

typedef greater<PII> GPII;



int n,a[100007],mn[4];



int main()

{

	scanf("%d",&n);

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

	{

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

		a[i]%=4;

		mn[a[i]]++;

	}

	if(mn[1]+mn[3]<=mn[0])OVER("Yes");

	else if(mn[1]+mn[3]+mn[0]==n&&mn[1]+mn[3]<=mn[0]+1)OVER("Yes");

	else OVER("No");

}

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



int n;

int x, y, z;

int a[100005];



int main()

{

	while (~scanf("%d", &n))

	{

		x = y = z = 0;

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

		{

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

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

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

			else z++;

		}



		/*printf("x = %d\n", x);

		printf("y = %d\n", y);

		printf("z = %d\n", z);*/



		if (y % 2)

		{

			if (x + 1>= 1 + z)

			{

				printf("Yes\n");

				continue;

			}

		}



		else if (y % 2 == 0)

		{

			if (x + 1>= z)

			{

				printf("Yes\n");

				continue;

			}

		}



		printf("No\n");

	}

	return 0;

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

using namespace std;

int a[100010];

int num[100010];



int main()

{

	int l,r,i,j,n;

	int x0=0,x1=0,x2=0;

	ios::sync_with_stdio(false);

	cin>>n;

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

	{

		cin>>a[i];

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

		{

			a[i]/=2;

			num[i]++;

		}

		if(num[i]==0) x0++;

		else if(num[i]==1) x1++;

		else x2++;

	}

	l=x0;

	if(x1>0) l++;

	r=x2;

	if(r+1>=l) cout<<"Yes\n";

	else cout<<"No\n";

	return 0;

}

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



int n;

int x, y, z;

int a[100005];



int main()

{

	while (~scanf("%d", &n))

	{

		x = y = z = 0;

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

		{

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

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

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

			else z++;

		}



		/*printf("x = %d\n", x);

		printf("y = %d\n", y);

		printf("z = %d\n", z);*/



		if (y % 2)

		{

			if (x + 1>= 1 + z)

			{

				printf("Yes\n");

				continue;

			}

		}



		else if (y % 2 == 0)

		{

			if (x + 1>= z)

			{

				printf("Yes\n");

				continue;

			}

		}



		printf("No\n");

	}

	return 0;

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



using namespace std;



const int maxn = 1e5 + 7;

int main(){

    int n, num2 = 0, num4 = 0;

    scanf("%d", &n);

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

        int x;

        scanf("%d", &x);

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

        if(x % 2 == 0) num2++;

    }

    num2 -= num4;

    if(num2 > 0)

    n -= num2 - 1;

    if(num4 >= n / 2) puts("Yes");

    else puts("No");

    return 0;

}


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



int n;

int x, y, z;

int a[100005];



int main()

{

	while (~scanf("%d", &n))

	{

		x = y = z = 0;

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

		{

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

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

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

			else z++;

		}



		/*printf("x = %d\n", x);

		printf("y = %d\n", y);

		printf("z = %d\n", z);*/



		if (y % 2)

		{

			if (x + 1>= 1 + z)

			{

				printf("Yes\n");

				continue;

			}

		}



		else if (y % 2 == 0)

		{

			if (x + 1>= z)

			{

				printf("Yes\n");

				continue;

			}

		}



		printf("No\n");

	}

	return 0;

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

#include <cstring>

using namespace std;



int mp[3];

int n, x;



int main() {

	ios::sync_with_stdio(false);

	while (cin >> n) {

		memset(mp, 0, sizeof(mp));

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

			cin >> x;

			if (x % 4 == 0)

				mp[2]++;

			else if (x % 2 == 0)

				mp[1]++;

			else

				mp[0]++;

		}

		if (mp[1] > 0)

			mp[0]++;

		if (mp[0] - 1 > mp[2])

			cout << "No\n";

		else

			cout << "Yes\n";

	}

	return 0;

}

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



int n;

int x, y, z;

int a[100005];



int main()

{

	while (~scanf("%d", &n))

	{

		x = y = z = 0;

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

		{

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

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

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

			else z++;

		}



		/*printf("x = %d\n", x);

		printf("y = %d\n", y);

		printf("z = %d\n", z);*/



		if (y % 2)

		{

			if (x + 1>= 1 + z)

			{

				printf("Yes\n");

				continue;

			}

		}



		else if (y % 2 == 0)

		{

			if (x + 1>= z)

			{

				printf("Yes\n");

				continue;

			}

		}



		printf("No\n");

	}

	return 0;

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

#include <iostream>

#include <string.h>

#include <stdio.h>

using namespace std;



int a[100005];



int main()

{

    int n , x, y;

    cin >> n;

    bool flag = false;

    x = y = 0;

    for(int i = 0; i < n; i++) cin>>a[i];

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

    {

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

            x++;

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

            y++;

        if(x * 2 + y >= n || x >= n / 2)

            flag = true;

    }

    if(flag) puts("Yes");

    else puts("No");

    return 0;

}


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



int n;

int x, y, z;

int a[100005];



int main()

{

	while (~scanf("%d", &n))

	{

		x = y = z = 0;

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

		{

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

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

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

			else z++;

		}



		/*printf("x = %d\n", x);

		printf("y = %d\n", y);

		printf("z = %d\n", z);*/



		if (y % 2)

		{

			if (x + 1>= 1 + z)

			{

				printf("Yes\n");

				continue;

			}

		}



		else if (y % 2 == 0)

		{

			if (x + 1>= z)

			{

				printf("Yes\n");

				continue;

			}

		}



		printf("No\n");

	}

	return 0;

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



using namespace std;

int a[100005];

int main()

{

    int N;

    while(cin>>N)

    {

        int mo2=0;

        int mo1=0;

        int mo4=0;

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

        {

            cin>>a[i];

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

            {

                mo4++;

            }

            else

            {

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

                    mo2++;

                else

                    mo1++;

            }

        }

        if(mo2!=0)

        {

            mo1++;

        }

        if(mo4>=mo1-1)

        {

            cout<<"Yes"<<endl;

        }

        else

        {

            cout<<"No"<<endl;

        }



    }

    return 0;

}


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



int n;

int x, y, z;

int a[100005];



int main()

{

	while (~scanf("%d", &n))

	{

		x = y = z = 0;

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

		{

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

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

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

			else z++;

		}



		/*printf("x = %d\n", x);

		printf("y = %d\n", y);

		printf("z = %d\n", z);*/



		if (y % 2)

		{

			if (x + 1>= 1 + z)

			{

				printf("Yes\n");

				continue;

			}

		}



		else if (y % 2 == 0)

		{

			if (x + 1>= z)

			{

				printf("Yes\n");

				continue;

			}

		}



		printf("No\n");

	}

	return 0;

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

using namespace std;

int main()

{

    int n;

    while (~scanf("%d", &n))

    {

        int cnte = 0, cnt4 = 0, cnt2 = 0;

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

        {

            int num;

            scanf("%d", &num);

            if (num % 2) cnte++;

            else if (num % 4) cnt2++;

            else cnt4++;

        }

        if (cnt2 == 0)

        {

            if (cnt4 >= cnte - 1)printf("Yes\n");

            else printf("No\n");

        }

        else if(cnt4>=cnte)printf("Yes\n");

        else printf("No\n");

    }

    return 0;

}

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



int n;

int x, y, z;

int a[100005];



int main()

{

	while (~scanf("%d", &n))

	{

		x = y = z = 0;

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

		{

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

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

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

			else z++;

		}



		/*printf("x = %d\n", x);

		printf("y = %d\n", y);

		printf("z = %d\n", z);*/



		if (y % 2)

		{

			if (x + 1>= 1 + z)

			{

				printf("Yes\n");

				continue;

			}

		}



		else if (y % 2 == 0)

		{

			if (x + 1>= z)

			{

				printf("Yes\n");

				continue;

			}

		}



		printf("No\n");

	}

	return 0;

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

using namespace std;



int n,a[100010],sum1,sum2,cnt1,cnt2;



int main()

{

	cin>>n;

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

	{

		cin>>a[i];

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

		if(a[i]%4==1||a[i]%4==3) sum2++;

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

		if(a[i]==2) cnt2++;

		

	}

	sum1+=cnt2/2;

	if(sum1+1>=sum2+min(1,cnt1)) cout<<"Yes"; else cout<<"No";

	

	return 0;

}

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

using namespace std;

int main()

{

    int a=0,b=0,c=0;//a奇数，b能被4整除，c被2整除

    int n;

    while(~scanf("%d",&n)){

            a=0,b=0,c=0;

    int s;

    while(n--)

    {

        scanf("%d",&s);

        if(s%2==1)

            a++;

        else

        {

            if(s%4==0)

                b++;

            else

                c++;

        }

    }

    if(a>b+1||(a==b+1&&c!=0))

        printf("No\n");

    else

         printf("Yes\n");

    }

        return 0;

}
// Slower C++ solution:
/*

×¢Òâ·¶Î§£¡

short·¶Î§£º-32768~32767

unsigned short·¶Î§£º0~65535

int·¶Î§£º-2147483648~2147483647

uint·¶Î§£º0~4294967295

INT·¶Î§£º-9223372036854775808~9223372036854775807

UINT·¶Î§£º0~18446744073709551615

float·¶Î§£º-3.4e38~3.4e38£¬¾«¶È£º6~7Î»

double·¶Î§£º-1.7e308~1.7e308£¬¾«¶È£º15~16Î»

ldouble·¶Î§£º-1.2e4932~1.2e4932£¬¾«¶È£º18~19Î»

*/

#include <algorithm>

#include <bitset>

#include <cassert>

#include <cctype>

#include <cmath>

#include <complex>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <ctime>

#include <deque>

#include <fstream>

#include <functional>

#include <iomanip>

#include <iostream>

#include <list>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <string>

#include <utility>

#include <vector>

#define LL long long

#define pb push_back

#define pob pop_back

#define mp make_pair

#define FILL(a,v) memset((void*)a,v,sizeof(a))

#define FILL0(a) FILL(a,0)

#define FILL1(a) FILL(a,-1)

#define ALL(a) (a).begin(),(a).end()

#define Inf 1e9

#define Mod 1000000007

#define foreach(it,x) for(typeof(x.begin()) it=x.begin();it!=x.end();it++)

#define FOR(i,x) for(int i=0;i<x;i++)

#define RFOR(i,x) for(int i=x-1;i>=0;i--)

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

#define FRFOR(i,a,b) for(int i=a-1;i>=b;i--)

#define SZ(a) ((int)(a).size())

#define FI first

#define SE second

#define OVER(a) return puts(a),0

#define fastio ios::sync_with_stdio(0)

#define filei(f) freopen(f,"r",stdin)

#define fileo(f) freopen(f,"w",stdout)

using namespace std;

typedef pair<int,int> pii;

typedef unsigned long long UINT;

typedef unsigned int Uint;

typedef long long INT;

typedef pair<INT,INT> PII;

typedef vector<int> vint;

typedef vector<INT> VINT;

typedef vector<pii> vpii;

typedef vector<PII> VPII;

typedef greater<int> gint;

typedef greater<INT> GINT;

typedef greater<pii> gpii;

typedef greater<PII> GPII;



int n,a[100007],mn[4];



int main()

{

	scanf("%d",&n);

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

	{

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

		a[i]%=4;

		mn[a[i]]++;

	}

	if(mn[1]+mn[3]<=mn[0])OVER("Yes");

	else if(mn[1]+mn[3]+mn[0]==n&&mn[1]+mn[3]<=mn[0]+1)OVER("Yes");

	else OVER("No");

}

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

using namespace std;

int main()

{

    int a=0,b=0,c=0;//a奇数，b能被4整除，c被2整除

    int n;

    while(~scanf("%d",&n)){

            a=0,b=0,c=0;

    int s;

    while(n--)

    {

        scanf("%d",&s);

        if(s%2==1)

            a++;

        else

        {

            if(s%4==0)

                b++;

            else

                c++;

        }

    }

    if(a>b+1||(a==b+1&&c!=0))

        printf("No\n");

    else

         printf("Yes\n");

    }

        return 0;

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

using namespace std;

int a[100010];

int num[100010];



int main()

{

	int l,r,i,j,n;

	int x0=0,x1=0,x2=0;

	ios::sync_with_stdio(false);

	cin>>n;

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

	{

		cin>>a[i];

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

		{

			a[i]/=2;

			num[i]++;

		}

		if(num[i]==0) x0++;

		else if(num[i]==1) x1++;

		else x2++;

	}

	l=x0;

	if(x1>0) l++;

	r=x2;

	if(r+1>=l) cout<<"Yes\n";

	else cout<<"No\n";

	return 0;

}

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

using namespace std;

int main()

{

    int a=0,b=0,c=0;//a奇数，b能被4整除，c被2整除

    int n;

    while(~scanf("%d",&n)){

            a=0,b=0,c=0;

    int s;

    while(n--)

    {

        scanf("%d",&s);

        if(s%2==1)

            a++;

        else

        {

            if(s%4==0)

                b++;

            else

                c++;

        }

    }

    if(a>b+1||(a==b+1&&c!=0))

        printf("No\n");

    else

         printf("Yes\n");

    }

        return 0;

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



using namespace std;



const int maxn = 1e5 + 7;

int main(){

    int n, num2 = 0, num4 = 0;

    scanf("%d", &n);

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

        int x;

        scanf("%d", &x);

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

        if(x % 2 == 0) num2++;

    }

    num2 -= num4;

    if(num2 > 0)

    n -= num2 - 1;

    if(num4 >= n / 2) puts("Yes");

    else puts("No");

    return 0;

}


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

using namespace std;

int main()

{

    int a=0,b=0,c=0;//a奇数，b能被4整除，c被2整除

    int n;

    while(~scanf("%d",&n)){

            a=0,b=0,c=0;

    int s;

    while(n--)

    {

        scanf("%d",&s);

        if(s%2==1)

            a++;

        else

        {

            if(s%4==0)

                b++;

            else

                c++;

        }

    }

    if(a>b+1||(a==b+1&&c!=0))

        printf("No\n");

    else

         printf("Yes\n");

    }

        return 0;

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

#include <cstring>

using namespace std;



int mp[3];

int n, x;



int main() {

	ios::sync_with_stdio(false);

	while (cin >> n) {

		memset(mp, 0, sizeof(mp));

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

			cin >> x;

			if (x % 4 == 0)

				mp[2]++;

			else if (x % 2 == 0)

				mp[1]++;

			else

				mp[0]++;

		}

		if (mp[1] > 0)

			mp[0]++;

		if (mp[0] - 1 > mp[2])

			cout << "No\n";

		else

			cout << "Yes\n";

	}

	return 0;

}

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

using namespace std;

int main()

{

    int a=0,b=0,c=0;//a奇数，b能被4整除，c被2整除

    int n;

    while(~scanf("%d",&n)){

            a=0,b=0,c=0;

    int s;

    while(n--)

    {

        scanf("%d",&s);

        if(s%2==1)

            a++;

        else

        {

            if(s%4==0)

                b++;

            else

                c++;

        }

    }

    if(a>b+1||(a==b+1&&c!=0))

        printf("No\n");

    else

         printf("Yes\n");

    }

        return 0;

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

#include <iostream>

#include <string.h>

#include <stdio.h>

using namespace std;



int a[100005];



int main()

{

    int n , x, y;

    cin >> n;

    bool flag = false;

    x = y = 0;

    for(int i = 0; i < n; i++) cin>>a[i];

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

    {

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

            x++;

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

            y++;

        if(x * 2 + y >= n || x >= n / 2)

            flag = true;

    }

    if(flag) puts("Yes");

    else puts("No");

    return 0;

}


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

using namespace std;

int main()

{

    int a=0,b=0,c=0;//a奇数，b能被4整除，c被2整除

    int n;

    while(~scanf("%d",&n)){

            a=0,b=0,c=0;

    int s;

    while(n--)

    {

        scanf("%d",&s);

        if(s%2==1)

            a++;

        else

        {

            if(s%4==0)

                b++;

            else

                c++;

        }

    }

    if(a>b+1||(a==b+1&&c!=0))

        printf("No\n");

    else

         printf("Yes\n");

    }

        return 0;

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



using namespace std;

int a[100005];

int main()

{

    int N;

    while(cin>>N)

    {

        int mo2=0;

        int mo1=0;

        int mo4=0;

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

        {

            cin>>a[i];

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

            {

                mo4++;

            }

            else

            {

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

                    mo2++;

                else

                    mo1++;

            }

        }

        if(mo2!=0)

        {

            mo1++;

        }

        if(mo4>=mo1-1)

        {

            cout<<"Yes"<<endl;

        }

        else

        {

            cout<<"No"<<endl;

        }



    }

    return 0;

}


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

using namespace std;

int main()

{

    int a=0,b=0,c=0;//a奇数，b能被4整除，c被2整除

    int n;

    while(~scanf("%d",&n)){

            a=0,b=0,c=0;

    int s;

    while(n--)

    {

        scanf("%d",&s);

        if(s%2==1)

            a++;

        else

        {

            if(s%4==0)

                b++;

            else

                c++;

        }

    }

    if(a>b+1||(a==b+1&&c!=0))

        printf("No\n");

    else

         printf("Yes\n");

    }

        return 0;

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

using namespace std;

int main()

{

    int n;

    while (~scanf("%d", &n))

    {

        int cnte = 0, cnt4 = 0, cnt2 = 0;

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

        {

            int num;

            scanf("%d", &num);

            if (num % 2) cnte++;

            else if (num % 4) cnt2++;

            else cnt4++;

        }

        if (cnt2 == 0)

        {

            if (cnt4 >= cnte - 1)printf("Yes\n");

            else printf("No\n");

        }

        else if(cnt4>=cnte)printf("Yes\n");

        else printf("No\n");

    }

    return 0;

}

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

using namespace std;

int main()

{

    int a=0,b=0,c=0;//a奇数，b能被4整除，c被2整除

    int n;

    while(~scanf("%d",&n)){

            a=0,b=0,c=0;

    int s;

    while(n--)

    {

        scanf("%d",&s);

        if(s%2==1)

            a++;

        else

        {

            if(s%4==0)

                b++;

            else

                c++;

        }

    }

    if(a>b+1||(a==b+1&&c!=0))

        printf("No\n");

    else

         printf("Yes\n");

    }

        return 0;

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

#define max(a,b) ((a>b)?(a):(b))

#define min(a,b) ((a<b)?(a):(b))

#define MEM(a,b) memset(a,b,sizeof(a))

using namespace std;

typedef long long LL;

typedef pair<int,int>pii;

const int mod = 1e9 + 7;

int a[200200];

int main() {

    int n, x;

    scanf("%d", &n);

    int four = 0;

    int two = 0;

    int not_four = 0;

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

        scanf("%d", &x);

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

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

        else not_four++;

    }

    if(two == 0) {

        if(four + 1 < not_four) puts("No");

        else puts("Yes");

    } else {

        if(four < not_four) puts("No");

        else puts("Yes");

    }

}


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

using namespace std;

int main()

{

    int a=0,b=0,c=0;//a奇数，b能被4整除，c被2整除

    int n;

    while(~scanf("%d",&n)){

            a=0,b=0,c=0;

    int s;

    while(n--)

    {

        scanf("%d",&s);

        if(s%2==1)

            a++;

        else

        {

            if(s%4==0)

                b++;

            else

                c++;

        }

    }

    if(a>b+1||(a==b+1&&c!=0))

        printf("No\n");

    else

         printf("Yes\n");

    }

        return 0;

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

using namespace std;

int main(){

	int n,m,count,c2;

	while (cin>>n){

		count=0;

		c2=0;

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

	    	cin>>m;

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

	    	if (m%2==0&&m/2%2!=0)c2++;

		}

		   int c1=n-count-c2;

		   if ((c2&&count>=c1)||(c2==0&&count>=c1-1))cout<<"Yes"<<endl;

		   else cout<<"No"<<endl;

	}

	return 0;

}

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

using namespace std;

int main()

{

    int a=0,b=0,c=0;//a奇数，b能被4整除，c被2整除

    int n;

    while(~scanf("%d",&n)){

            a=0,b=0,c=0;

    int s;

    while(n--)

    {

        scanf("%d",&s);

        if(s%2==1)

            a++;

        else

        {

            if(s%4==0)

                b++;

            else

                c++;

        }

    }

    if(a>b+1||(a==b+1&&c!=0))

        printf("No\n");

    else

         printf("Yes\n");

    }

        return 0;

}