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

#include<iostream>

#include<cstring>

using namespace std;

const int mod = 1000000007;

int num[100005];

int poss[100005];

long long PowerMod(long long a, long long b, long long c)

{

long long ans = 1;

a = a % c;

while(b>0)

{

if(b % 2 == 1)

ans = (ans * a) % c;

b = b/2;

a = (a * a) % c;

}

return ans;

}

int main()

{

    long long  n;

    memset(poss,0,sizeof(poss));

    cin>>n;

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

    {

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

        poss[num[i]]++;

    }

    if(n%2==0)

    {

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

        {

            if(poss[i]!=2)

            {

                printf("0\n"); return 0;

            }

        }

        long long  k = n/2;

        cout<<PowerMod(2ll,k,mod)<<endl;

    }

    else

    {

        if(poss[0]!=1) {printf("0\n");return 0; }

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

        {



            if(poss[i]!=2)

            {

                printf("0\n"); return 0;

            }

        }

            long long  k = n/2;

            cout<<PowerMod(2ll,k,mod)<<endl;

    }

    return 0;

}


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

#include <cstdio>

using namespace std;

const int mod = 1e9 + 7;

const int maxn = 1e5 + 5;

int a[maxn];

int cnt[maxn];

typedef long long ll;



void quickpow(int b)

{

    ll res = 1,k = 2;

    while(b)

    {

        if(b & 1) res = (res % mod * k % mod ) % mod;

        b >>= 1;

        k = k * k % mod;

    }

    cout << res << endl;

}

int main()

{

    int n;

    cin >> n;

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

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

        cnt[a[i]] ++;

    }

    bool fg = true;

    if (n % 2) {

        if(cnt[0] != 1) fg = false;

    }

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

        if(cnt[i] != 2) {fg = false;break;}

    }

   if(fg)

   {

       if(n % 2) quickpow((n - 1) / 2);

       else quickpow(n / 2);

   }

   else cout << 0 << endl;

    return 0;

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

#include<cstdio>

#include<vector>

#include<queue>

#include<utility>

#include<stack>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

const int maxn = 1e5 + 5;

const int mod = 1e9 + 7;

int a[maxn];

long long b[maxn];



void init() {

	long long tmp = 1;

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

		tmp = (tmp * i) % mod;

		b[i] = tmp;

	}

}



bool cmp(int x, int y) {

	return x > y;

}



int main() {

	int n;

	long long ans = 1;

	bool flag = 1;

	init();

	cin >> n;

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

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

	}

	sort(a, a + n, cmp);

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

		int key = 1, j = i + 1;

		while(j < n && a[j] == a[i]) {

			j++;

			key++;

		}

		i = j - 1;

		if(key % 2 == 0) {

			ans = (ans * b[key]) % mod;

		} else {

			if(i != n - 1) {

				ans = 0;

			}

			break;

		}

	}

	cout << ans << '\n';

	return 0;

}


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

#include <cstdio>

using namespace std;

const int mod = 1e9 + 7;

const int maxn = 1e5 + 5;

int a[maxn];

int cnt[maxn];

typedef long long ll;



void quickpow(int b)

{

    ll res = 1,k = 2;

    while(b)

    {

        if(b & 1) res = (res % mod * k % mod ) % mod;

        b >>= 1;

        k = k * k % mod;

    }

    cout << res << endl;

}

int main()

{

    int n;

    cin >> n;

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

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

        cnt[a[i]] ++;

    }

    bool fg = true;

    if (n % 2) {

        if(cnt[0] != 1) fg = false;

    }

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

        if(cnt[i] != 2) {fg = false;break;}

    }

   if(fg)

   {

       if(n % 2) quickpow((n - 1) / 2);

       else quickpow(n / 2);

   }

   else cout << 0 << endl;

    return 0;

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

#include<iostream>

#include<cstring>

using namespace std;

const int mod = 1000000007;

int num[100005];

int poss[100005];

long long PowerMod(long long a, long long b, long long c)

{

long long ans = 1;

a = a % c;

while(b>0)

{

if(b % 2 == 1)

ans = (ans * a) % c;

b = b/2;

a = (a * a) % c;

}

return ans;

}

int main()

{

    long long  n;

    memset(poss,0,sizeof(poss));

    cin>>n;

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

    {

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

        poss[num[i]]++;

    }

    if(n%2==0)

    {

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

        {

            if(poss[i]!=2)

            {

                printf("0\n"); return 0;

            }

        }

        long long  k = n/2;

        cout<<PowerMod(2ll,k,mod)<<endl;

    }

    else

    {

        if(poss[0]!=1) {printf("0\n");return 0; }

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

        {



            if(poss[i]!=2)

            {

                printf("0\n"); return 0;

            }

        }

            long long  k = n/2;

            cout<<PowerMod(2ll,k,mod)<<endl;

    }

    return 0;

}


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

using namespace std;

#include<cstring>

int a[100005];

int main()

{

	int n;

	int ans;

	scanf("%d",&n);

	int flag=0;

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

	{

		int b;

		scanf("%d",&b);

		a[b]++;

	}

	if(n%2==1)

	if(a[0]!=1)

	{

	flag=1;	

	}

	if(n%2==0)

	if(a[0]!=0)

	flag=1;

	if(flag)

	{

		printf("0");

		exit(0);

	}

	for(int i=n%2+1;i<n-1;i+=2)

	{

		if(a[i]!=2)

		{

			flag=1;

			break;

		}

	}

	if(flag)

	printf("0");

	else

	{

		ans=n/2;

		long long c=1;

		long long mod=1e9+7;

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

		{

		c*=2;

		c=c%mod;

		}

		cout<<c;

	}

	 

	return 0;	

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

#include<cstdio>

#include<vector>

#include<queue>

#include<utility>

#include<stack>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

const int maxn = 1e5 + 5;

const int mod = 1e9 + 7;

int a[maxn];

long long b[maxn];



void init() {

	long long tmp = 1;

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

		tmp = (tmp * i) % mod;

		b[i] = tmp;

	}

}



bool cmp(int x, int y) {

	return x > y;

}



int main() {

	int n;

	long long ans = 1;

	bool flag = 1;

	init();

	cin >> n;

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

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

	}

	sort(a, a + n, cmp);

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

		int key = 1, j = i + 1;

		while(j < n && a[j] == a[i]) {

			j++;

			key++;

		}

		i = j - 1;

		if(key % 2 == 0) {

			ans = (ans * b[key]) % mod;

		} else {

			if(i != n - 1) {

				ans = 0;

			}

			break;

		}

	}

	cout << ans << '\n';

	return 0;

}


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

using namespace std;

#include<cstring>

int a[100005];

int main()

{

	int n;

	int ans;

	scanf("%d",&n);

	int flag=0;

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

	{

		int b;

		scanf("%d",&b);

		a[b]++;

	}

	if(n%2==1)

	if(a[0]!=1)

	{

	flag=1;	

	}

	if(n%2==0)

	if(a[0]!=0)

	flag=1;

	if(flag)

	{

		printf("0");

		exit(0);

	}

	for(int i=n%2+1;i<n-1;i+=2)

	{

		if(a[i]!=2)

		{

			flag=1;

			break;

		}

	}

	if(flag)

	printf("0");

	else

	{

		ans=n/2;

		long long c=1;

		long long mod=1e9+7;

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

		{

		c*=2;

		c=c%mod;

		}

		cout<<c;

	}

	 

	return 0;	

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

#include<iostream>

#include<cstring>

using namespace std;

const int mod = 1000000007;

int num[100005];

int poss[100005];

long long PowerMod(long long a, long long b, long long c)

{

long long ans = 1;

a = a % c;

while(b>0)

{

if(b % 2 == 1)

ans = (ans * a) % c;

b = b/2;

a = (a * a) % c;

}

return ans;

}

int main()

{

    long long  n;

    memset(poss,0,sizeof(poss));

    cin>>n;

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

    {

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

        poss[num[i]]++;

    }

    if(n%2==0)

    {

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

        {

            if(poss[i]!=2)

            {

                printf("0\n"); return 0;

            }

        }

        long long  k = n/2;

        cout<<PowerMod(2ll,k,mod)<<endl;

    }

    else

    {

        if(poss[0]!=1) {printf("0\n");return 0; }

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

        {



            if(poss[i]!=2)

            {

                printf("0\n"); return 0;

            }

        }

            long long  k = n/2;

            cout<<PowerMod(2ll,k,mod)<<endl;

    }

    return 0;

}


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

#include<cstdio>

#include<algorithm>

#include<cstring>

#include<cmath>

#include<set>

using namespace std;



typedef long long ll;

const ll mod=1e9+7;

const int M=1e5+10;

int a[M],b[M];



ll poww(int a,int b){

    ll ans=1;

    ll aa=a;

    while(b>0)

    {

        if(b&1)

            ans=(ans*aa)%mod;

        aa=(aa*aa)%mod;

        b>>=1;

    }

    return ans;

}



/**/int comp(int *a,int *b,int n){

    if(a[0]<b[0])

        return 1;

    else

        if(a[0]>b[0])

        return -1;

    else

        if(n==1)

        return 0;

    else

        return comp(a+1,b+1,n-1);

}



int main(){

    int n;

    while(scanf("%d",&n)!=EOF){

        int flag=0;

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

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

        sort(a,a+n);

        if(n%2){

            b[0]=0;

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

                b[i]=i+1;

                b[i+1]=i+1;

            }



        }

        else

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

                b[i]=b[i+1]=i+1;

            }

        if(comp(a,b,n)!=0)

            printf("0\n");

        else{

            ll ans=poww(2,n/2);

            printf("%I64d\n",ans);

        }

    }

    return 0;

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

#include<cstdio>

#include<vector>

#include<queue>

#include<utility>

#include<stack>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

const int maxn = 1e5 + 5;

const int mod = 1e9 + 7;

int a[maxn];

long long b[maxn];



void init() {

	long long tmp = 1;

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

		tmp = (tmp * i) % mod;

		b[i] = tmp;

	}

}



bool cmp(int x, int y) {

	return x > y;

}



int main() {

	int n;

	long long ans = 1;

	bool flag = 1;

	init();

	cin >> n;

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

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

	}

	sort(a, a + n, cmp);

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

		int key = 1, j = i + 1;

		while(j < n && a[j] == a[i]) {

			j++;

			key++;

		}

		i = j - 1;

		if(key % 2 == 0) {

			ans = (ans * b[key]) % mod;

		} else {

			if(i != n - 1) {

				ans = 0;

			}

			break;

		}

	}

	cout << ans << '\n';

	return 0;

}


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

#include<cstdio>

#include<algorithm>

#include<cstring>

#include<cmath>

#include<set>

using namespace std;



typedef long long ll;

const ll mod=1e9+7;

const int M=1e5+10;

int a[M],b[M];



ll poww(int a,int b){

    ll ans=1;

    ll aa=a;

    while(b>0)

    {

        if(b&1)

            ans=(ans*aa)%mod;

        aa=(aa*aa)%mod;

        b>>=1;

    }

    return ans;

}



/**/int comp(int *a,int *b,int n){

    if(a[0]<b[0])

        return 1;

    else

        if(a[0]>b[0])

        return -1;

    else

        if(n==1)

        return 0;

    else

        return comp(a+1,b+1,n-1);

}



int main(){

    int n;

    while(scanf("%d",&n)!=EOF){

        int flag=0;

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

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

        sort(a,a+n);

        if(n%2){

            b[0]=0;

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

                b[i]=i+1;

                b[i+1]=i+1;

            }



        }

        else

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

                b[i]=b[i+1]=i+1;

            }

        if(comp(a,b,n)!=0)

            printf("0\n");

        else{

            ll ans=poww(2,n/2);

            printf("%I64d\n",ans);

        }

    }

    return 0;

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

#include<iostream>

#include<cstring>

using namespace std;

const int mod = 1000000007;

int num[100005];

int poss[100005];

long long PowerMod(long long a, long long b, long long c)

{

long long ans = 1;

a = a % c;

while(b>0)

{

if(b % 2 == 1)

ans = (ans * a) % c;

b = b/2;

a = (a * a) % c;

}

return ans;

}

int main()

{

    long long  n;

    memset(poss,0,sizeof(poss));

    cin>>n;

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

    {

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

        poss[num[i]]++;

    }

    if(n%2==0)

    {

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

        {

            if(poss[i]!=2)

            {

                printf("0\n"); return 0;

            }

        }

        long long  k = n/2;

        cout<<PowerMod(2ll,k,mod)<<endl;

    }

    else

    {

        if(poss[0]!=1) {printf("0\n");return 0; }

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

        {



            if(poss[i]!=2)

            {

                printf("0\n"); return 0;

            }

        }

            long long  k = n/2;

            cout<<PowerMod(2ll,k,mod)<<endl;

    }

    return 0;

}


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

#include <map>

using namespace std;



const int mod = 1e9 + 7;



long long pow_mod(long long x, long long n)

{

    long long res = 1;

    while(n > 0){

        if(n & 1) res = res * x % mod;

        x = x * x % mod;

        n >>= 1;

    }

    return res;

}



int main()

{

    int N, a[100000 + 10];

    map<int, int> m;

    cin>>N;

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

        cin>>a[i];

        m[a[i]]++;

    }



    if(N % 2 == 0){

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

            if(m[a[i]] != 2 || a[i] == 0 || a[i] >= N || a[i] % 2 != 1){

                cout<<"0"<<endl;

                return 0;

            }

        }

        cout<<pow_mod(2, N / 2)<<endl;

    }

    else{

        if(N == 1 && m[0] == 1){

            cout<<"1"<<endl;

            return 0;

        }

        if(m[0] != 1){

            cout<<"0"<<endl;

            return 0;

        }

        m[0]++;

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

            if(m[a[i]] != 2 || a[i] >= N || a[i] % 2 != 0){

                cout<<"0"<<endl;

                return 0;

            }

        }

        cout<<pow_mod(2, N / 2)<<endl;

    }





    return 0;

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

#include<cstdio>

#include<vector>

#include<queue>

#include<utility>

#include<stack>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

const int maxn = 1e5 + 5;

const int mod = 1e9 + 7;

int a[maxn];

long long b[maxn];



void init() {

	long long tmp = 1;

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

		tmp = (tmp * i) % mod;

		b[i] = tmp;

	}

}



bool cmp(int x, int y) {

	return x > y;

}



int main() {

	int n;

	long long ans = 1;

	bool flag = 1;

	init();

	cin >> n;

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

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

	}

	sort(a, a + n, cmp);

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

		int key = 1, j = i + 1;

		while(j < n && a[j] == a[i]) {

			j++;

			key++;

		}

		i = j - 1;

		if(key % 2 == 0) {

			ans = (ans * b[key]) % mod;

		} else {

			if(i != n - 1) {

				ans = 0;

			}

			break;

		}

	}

	cout << ans << '\n';

	return 0;

}


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

#include <map>

using namespace std;



const int mod = 1e9 + 7;



long long pow_mod(long long x, long long n)

{

    long long res = 1;

    while(n > 0){

        if(n & 1) res = res * x % mod;

        x = x * x % mod;

        n >>= 1;

    }

    return res;

}



int main()

{

    int N, a[100000 + 10];

    map<int, int> m;

    cin>>N;

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

        cin>>a[i];

        m[a[i]]++;

    }



    if(N % 2 == 0){

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

            if(m[a[i]] != 2 || a[i] == 0 || a[i] >= N || a[i] % 2 != 1){

                cout<<"0"<<endl;

                return 0;

            }

        }

        cout<<pow_mod(2, N / 2)<<endl;

    }

    else{

        if(N == 1 && m[0] == 1){

            cout<<"1"<<endl;

            return 0;

        }

        if(m[0] != 1){

            cout<<"0"<<endl;

            return 0;

        }

        m[0]++;

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

            if(m[a[i]] != 2 || a[i] >= N || a[i] % 2 != 0){

                cout<<"0"<<endl;

                return 0;

            }

        }

        cout<<pow_mod(2, N / 2)<<endl;

    }





    return 0;

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

#include<iostream>

#include<cstring>

using namespace std;

const int mod = 1000000007;

int num[100005];

int poss[100005];

long long PowerMod(long long a, long long b, long long c)

{

long long ans = 1;

a = a % c;

while(b>0)

{

if(b % 2 == 1)

ans = (ans * a) % c;

b = b/2;

a = (a * a) % c;

}

return ans;

}

int main()

{

    long long  n;

    memset(poss,0,sizeof(poss));

    cin>>n;

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

    {

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

        poss[num[i]]++;

    }

    if(n%2==0)

    {

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

        {

            if(poss[i]!=2)

            {

                printf("0\n"); return 0;

            }

        }

        long long  k = n/2;

        cout<<PowerMod(2ll,k,mod)<<endl;

    }

    else

    {

        if(poss[0]!=1) {printf("0\n");return 0; }

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

        {



            if(poss[i]!=2)

            {

                printf("0\n"); return 0;

            }

        }

            long long  k = n/2;

            cout<<PowerMod(2ll,k,mod)<<endl;

    }

    return 0;

}


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

# include <map>

# include <cmath>



using namespace std;



const int mod = 1e9+7;



int main()

{

	int n;

	int  a[100005];

	map<int,int> m;

	scanf("%d",&n);

	

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

	{

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

		m[a[i]]++;

	}



	int flag = 0; 

	if(n%2) //奇数 

	{

		if(m[0] != 1)

		{

			flag = 1;

		}

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

		{

			if(m[i] != 2)

			{

				flag = 1;

			}

		}

	}else{

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

		{

			if(m[i] != 2)

			{

				flag = 1;

			}

		}

	}

	long long sum = 1;

	

	for(int i =0;i < floor(n/2);i++)

	{

		sum = ((sum % mod) * 2)% mod;

	}

	

	if(n%2)

	{

		if(flag)

		printf("0\n");

		else

		printf("%lld\n",sum);

	}	

	else

	{

		if(flag)

		printf("0\n");

		else

		printf("%lld\n",sum);

	}



	return 0;

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

#include<cstdio>

#include<vector>

#include<queue>

#include<utility>

#include<stack>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

const int maxn = 1e5 + 5;

const int mod = 1e9 + 7;

int a[maxn];

long long b[maxn];



void init() {

	long long tmp = 1;

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

		tmp = (tmp * i) % mod;

		b[i] = tmp;

	}

}



bool cmp(int x, int y) {

	return x > y;

}



int main() {

	int n;

	long long ans = 1;

	bool flag = 1;

	init();

	cin >> n;

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

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

	}

	sort(a, a + n, cmp);

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

		int key = 1, j = i + 1;

		while(j < n && a[j] == a[i]) {

			j++;

			key++;

		}

		i = j - 1;

		if(key % 2 == 0) {

			ans = (ans * b[key]) % mod;

		} else {

			if(i != n - 1) {

				ans = 0;

			}

			break;

		}

	}

	cout << ans << '\n';

	return 0;

}


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

# include <map>

# include <cmath>



using namespace std;



const int mod = 1e9+7;



int main()

{

	int n;

	int  a[100005];

	map<int,int> m;

	scanf("%d",&n);

	

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

	{

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

		m[a[i]]++;

	}



	int flag = 0; 

	if(n%2) //奇数 

	{

		if(m[0] != 1)

		{

			flag = 1;

		}

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

		{

			if(m[i] != 2)

			{

				flag = 1;

			}

		}

	}else{

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

		{

			if(m[i] != 2)

			{

				flag = 1;

			}

		}

	}

	long long sum = 1;

	

	for(int i =0;i < floor(n/2);i++)

	{

		sum = ((sum % mod) * 2)% mod;

	}

	

	if(n%2)

	{

		if(flag)

		printf("0\n");

		else

		printf("%lld\n",sum);

	}	

	else

	{

		if(flag)

		printf("0\n");

		else

		printf("%lld\n",sum);

	}



	return 0;

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

#include<iostream>

#include<cstring>

using namespace std;

const int mod = 1000000007;

int num[100005];

int poss[100005];

long long PowerMod(long long a, long long b, long long c)

{

long long ans = 1;

a = a % c;

while(b>0)

{

if(b % 2 == 1)

ans = (ans * a) % c;

b = b/2;

a = (a * a) % c;

}

return ans;

}

int main()

{

    long long  n;

    memset(poss,0,sizeof(poss));

    cin>>n;

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

    {

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

        poss[num[i]]++;

    }

    if(n%2==0)

    {

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

        {

            if(poss[i]!=2)

            {

                printf("0\n"); return 0;

            }

        }

        long long  k = n/2;

        cout<<PowerMod(2ll,k,mod)<<endl;

    }

    else

    {

        if(poss[0]!=1) {printf("0\n");return 0; }

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

        {



            if(poss[i]!=2)

            {

                printf("0\n"); return 0;

            }

        }

            long long  k = n/2;

            cout<<PowerMod(2ll,k,mod)<<endl;

    }

    return 0;

}


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

#include<map>

#define maxn 100010

#define ll long long

#define INF 1000000007

using namespace std; 

ll pow_mod(ll x,ll y,ll mod)

{

	ll ans=1;

	x=x%mod;

	while(y)

	{

		if(y&1)

		{

			ans=ans*x%mod;

		}

		x=x*x%mod;

		y>>=1;

	}

	return ans;

}

int main()

{

	int n;

	ll a[maxn];

	while(scanf("%d",&n)!=EOF)

	{

		int i;

		map<ll,ll> m;

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

		{

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

			m[a[i]]++;

		}

		map<ll,ll>::iterator it;

		int ans=0,flag=0;

		if(n%2==0)

		{

			for(it=m.begin();it!=m.end();it++)

			{

				if(it->first%2!=0&&it->second==2)

					ans++;

				else

				{

					flag=1;

						break;

				}

			}

		}

		else

		{

			for(it=m.begin();it!=m.end();it++)

			{

				if(it->first==0&&it->second==1)

					continue;

				else if(it->first%2==0&&it->second==2)

					ans++;

				else

				{

					//printf("%lld %lld\n",it->first,it->second);

					flag=1;

					break;

				}

			}

		}

		if(flag)

			printf("0\n");

		else

			printf("%lld\n",pow_mod(2,ans,INF));

	}

}