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

#include<string.h>

#include<algorithm>

using namespace std;

long long powmod(long long y,long long x){

	long long ans=1;

	while(x){

		if(x&1)

			ans=(y*ans)%1000000007;

		x/=2;

		y=(y*y)%1000000007;

		

	}

	return ans;

}

int main(){

	int n;

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

		int flag=0; 

		int a[100005];

	

		memset(a,0,sizeof(a));

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

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

		}

		sort(a,a+n);

		if(n%2){

			if(a[0]!=0||a[1]==0){

				flag=1;

			}

		}

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

			if(flag==1) break;

			if((n-1-a[i])%2) {

				flag=1;

				break;

			}

			if((a[i]==a[i+1]||a[i]==a[i-1])&&a[i+1]!=a[i-1])

				continue;

			else {

				flag=1;	

				break;

				}

		}

		if(n==1)

			printf("1\n");		

		else if(flag)printf("0\n");

		else printf("%lld\n",powmod((long long)2,(long long)n/2));

		

	}

	return 0;

}

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

#include<algorithm>

#include<cmath>

using namespace std;

int vist[100005];

int Q(int n){

	long long x = 2,ans = 1;

	while(n>0){

		if(n&1)		ans = ans*x%1000000007;

		x = x*x%1000000007;

		n/=2;

	}

	return ans;

}

void Init(int n){

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

		vist[i]	= 0;

}

int main()

{

	int n,m,F;

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

		Init(n);

		F = true;

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

			scanf("%d",&m);

			vist[m]++;		if(m>n-1)	F = false;

		}

		if(n%2!=0){

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

				if(i==0&&vist[i]!=1)		F = false;	

				if(i!=0&&i%2==0&&vist[i]!=2)		F = false;

				if(i%2!=0&&vist[i]!=0)		F = false;	

			}

			if(F){

				int c = Q((n-1)/2);

				printf("%d\n",c%1000000007);

			}

			else	printf("0\n");

		}

		

		else{

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

				if(i%2!=0&&vist[i]!=2)		F = false;

				if(i%2==0&&vist[i]!=0)		F = false;

			}

			if(F){

				int c = Q(n/2);

				printf("%d\n",c%1000000007);

			}

			else	printf("0\n");

		}

	}

	return 0;

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

#include<cstring>

using namespace std;

const long long M=1e9+7;

int main()

{

	int n;

	while(cin>>n)

	{

		int flag=1;

		int a[100005],b[100005];

		memset(b,0,sizeof(b));

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

		{

			cin>>a[i];

		}

		if(n%2==1)

		{	

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

			{

				b[a[i]]++;

			}

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

			{

				if(b[0]!=1)

				{

				    flag=0;

				    break;

			    }

				else if(b[i]==2)

				continue;

				else

				{

					flag=0;

					break;

				}

			} 

		}

		if(n%2==0)

		{

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

			{

				b[a[i]]++;

			}

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

			{

				if(b[i]==2)

				continue;

				else

				{

					flag=0;

					break;

				}

			}

	    }

	    long long sum=1;

		if(flag==1)

		{

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

			{

				sum*=2;

				sum%=M;

			}

			cout<<sum<<endl;

		}

		else

		cout<<"0"<<endl;

	}

	return 0;

} 

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

#ifndef ONLINE_JUDGE

#define debug(x) cout << #x << ": " << x << endl

#else

#define debug(x)

#endif

using namespace std;

typedef long long ll;

const int MAXN=2e5+7;

const int INF=0x3f3f3f3f;

const int mod=1e9+7;



map<int,int>mp;



ll quick(ll x,ll n)  //快速幂 x^n

{

    ll res=1;

    while(n)

    {

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

        x=(x*x)%mod;

        n>>=1;

    }

    return res;

}

int a[MAXN];

int main()

{

    ios::sync_with_stdio(false);

    cin.tie(0);

    int n;

    cin>>n;

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

    {

        cin>>x;

        a[x]++;

    }

    bool ok=1;

    if(n%2==0)

    {

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

        {

            if(a[i]!=2)

            {

                ok=0;break;

            }

        }

        if(ok) cout<<quick(2,n/2)<<endl;

        else cout<<0<<endl;

    }

    else

    {

        if(a[0]!=1) ok=0;

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

        {

            if(a[i]!=2)

            {

                ok=0;break;

            }

        }

        if(ok) cout<<quick(2,n/2)<<endl;

        else cout<<0<<endl;

    }

    return 0;

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

#include<cstring>

using namespace std;

const long long M=1e9+7;

int main()

{

	int n;

	while(cin>>n)

	{

		int flag=1;

		int a[100005],b[100005];

		memset(b,0,sizeof(b));

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

		{

			cin>>a[i];

		}

		if(n%2==1)

		{	

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

			{

				b[a[i]]++;

			}

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

			{

				if(b[0]!=1)

				{

				    flag=0;

				    break;

			    }

				else if(b[i]==2)

				continue;

				else

				{

					flag=0;

					break;

				}

			} 

		}

		if(n%2==0)

		{

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

			{

				b[a[i]]++;

			}

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

			{

				if(b[i]==2)

				continue;

				else

				{

					flag=0;

					break;

				}

			}

	    }

	    long long sum=1;

		if(flag==1)

		{

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

			{

				sum*=2;

				sum%=M;

			}

			cout<<sum<<endl;

		}

		else

		cout<<"0"<<endl;

	}

	return 0;

} 

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

#include<algorithm>

#include<map>

using namespace std;

typedef long long ll;

long long mod=1e9+7;



int main()

{

	int n;

	cin>>n;

	int a[n];

	map<ll,ll>m;

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

		{

			cin>>a[i];

			m[a[i]]++;

		}

	

	  if(m.count(0))

	  {

    	if(n%2==0 || m[0] != 1){

     		 cout << 0 << endl;

      	return 0;

      	}

    	m.erase(0);

  	  }

  

  	  ll ans = 1;

  	for(auto ite:m){

    if(ite.second %2 != 0){

      cout << 0 << endl;

      return 0;

    }

    ans *= ite.second % mod;

    ans %= mod;

  }

  cout << ans%mod << endl;

  

  

	

	return 0;

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

#include<cstring>

#include<iostream>

#include<string>

using namespace std;



typedef long long ll;



const ll mod = 1e9 + 7;

const int maxn = 1e5 + 5;



int a[maxn];



ll fast_mod(ll base, ll n) {

	ll res = 1;

	while (n > 0) {

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

		base = base * base % mod;

		n >>= 1;

	}

	return res;

}



int main() {

	int n, num;

	cin >> n;

	memset(a, 0, sizeof(a));

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

		cin >> num;

		a[num]++;

		if (a[num] > 2 || a[0] > 1 || (n - 1 + num) % 2) {

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

		}

	}

	cout << fast_mod(2, n / 2) << endl;

}

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

#include<algorithm>

#include<map>

using namespace std;

typedef long long ll;

long long mod=1e9+7;



int main()

{

	int n;

	cin>>n;

	int a[n];

	map<ll,ll>m;

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

		{

			cin>>a[i];

			m[a[i]]++;

		}

	

	  if(m.count(0))

	  {

    	if(n%2==0 || m[0] != 1){

     		 cout << 0 << endl;

      	return 0;

      	}

    	m.erase(0);

  	  }

  

  	  ll ans = 1;

  	for(auto ite:m){

    if(ite.second %2 != 0){

      cout << 0 << endl;

      return 0;

    }

    ans *= ite.second % mod;

    ans %= mod;

  }

  cout << ans%mod << endl;

  

  

	

	return 0;

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

#include<cstring>

using namespace std;

const long long M=1e9+7;

int main()

{

	int n;

	while(cin>>n)

	{

		int flag=1;

		int a[100005],b[100005];

		memset(b,0,sizeof(b));

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

		{

			cin>>a[i];

		}

		if(n%2==1)

		{	

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

			{

				b[a[i]]++;

			}

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

			{

				if(b[0]!=1)

				{

				    flag=0;

				    break;

			    }

				else if(b[i]==2)

				continue;

				else

				{

					flag=0;

					break;

				}

			} 

		}

		if(n%2==0)

		{

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

			{

				b[a[i]]++;

			}

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

			{

				if(b[i]==2)

				continue;

				else

				{

					flag=0;

					break;

				}

			}

	    }

	    long long sum=1;

		if(flag==1)

		{

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

			{

				sum*=2;

				sum%=M;

			}

			cout<<sum<<endl;

		}

		else

		cout<<"0"<<endl;

	}

	return 0;

} 

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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>



using namespace std;

using namespace __gnu_pbds;



using ll = long long;

using ull = unsigned long long;

using vl = vector<ll>;

using vi = vector<int>;

using vchar = vector<char>;

using vstr = vector<string>;

using pll =  pair<ll,ll>;



const ll mod = 1000000007;

const ll inf = 1000000000000000;



#define pi acos(-1)

#define pb push_back

#define test int TEST;cin>>TEST;while(TEST--)

#define vsort(xx) sort(xx.begin(),xx.end())

#define vrevsort(xx) sort(xx.rbegin(),xx.rend())



ull power(int a,int b){

    ull r=1;

    while(b){

        if(b & 1){

            r=((r%mod)*(a%mod))%mod;

            b--;

        }

        a=((a%mod)*(a%mod))%mod;

        b>>=1;

    }

    return r;

}





int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);cout.tie(NULL);

    int n,i;cin>>n;

    vi a(n);

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

    vsort(a);

    int val;

    vi ans(n);

    if(n%2){

        //3- 0 2 2

        //5- 0 2 2 4 4

        //7- 0 2 2 4 4 6 6

        ans[0]=0;

        val=0;

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

            ans[i]=val+2;

            ans[i+1]=val+2;

            val+=2;

        }}

        else{

            /*

            2-1 1

            4-1 1 2 2

            6-1 1 3 3 5 5*/

            val=1;

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

                ans[i]=val;

                ans[i+1]=val;

                val+=2;

            }

        }

        //for(i=0;i<n;i++){cout<<ans[i]<<" ";}

        if(ans==a){

           /* 3-1*2

            5-1*2*2

            7-1*2*2*2

            2-2

            4-2*2

            6-2*2*2*/

    

            cout<<power(2,n/2)%1000000007;

        }

        else cout<<0;

        

        

    

    

    

   

    return 0;

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

#include<cstring>

#include<iostream>

#include<string>

using namespace std;



typedef long long ll;



const ll mod = 1e9 + 7;

const int maxn = 1e5 + 5;



int a[maxn];



ll fast_mod(ll base, ll n) {

	ll res = 1;

	while (n > 0) {

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

		base = base * base % mod;

		n >>= 1;

	}

	return res;

}



int main() {

	int n, num;

	cin >> n;

	memset(a, 0, sizeof(a));

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

		cin >> num;

		a[num]++;

		if (a[num] > 2 || a[0] > 1 || (n - 1 + num) % 2) {

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

		}

	}

	cout << fast_mod(2, n / 2) << endl;

}

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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>



using namespace std;

using namespace __gnu_pbds;



using ll = long long;

using ull = unsigned long long;

using vl = vector<ll>;

using vi = vector<int>;

using vchar = vector<char>;

using vstr = vector<string>;

using pll =  pair<ll,ll>;



const ll mod = 1000000007;

const ll inf = 1000000000000000;



#define pi acos(-1)

#define pb push_back

#define test int TEST;cin>>TEST;while(TEST--)

#define vsort(xx) sort(xx.begin(),xx.end())

#define vrevsort(xx) sort(xx.rbegin(),xx.rend())



ull power(int a,int b){

    ull r=1;

    while(b){

        if(b & 1){

            r=((r%mod)*(a%mod))%mod;

            b--;

        }

        a=((a%mod)*(a%mod))%mod;

        b>>=1;

    }

    return r;

}





int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);cout.tie(NULL);

    int n,i;cin>>n;

    vi a(n);

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

    vsort(a);

    int val;

    vi ans(n);

    if(n%2){

        //3- 0 2 2

        //5- 0 2 2 4 4

        //7- 0 2 2 4 4 6 6

        ans[0]=0;

        val=0;

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

            ans[i]=val+2;

            ans[i+1]=val+2;

            val+=2;

        }}

        else{

            /*

            2-1 1

            4-1 1 2 2

            6-1 1 3 3 5 5*/

            val=1;

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

                ans[i]=val;

                ans[i+1]=val;

                val+=2;

            }

        }

        //for(i=0;i<n;i++){cout<<ans[i]<<" ";}

        if(ans==a){

           /* 3-1*2

            5-1*2*2

            7-1*2*2*2

            2-2

            4-2*2

            6-2*2*2*/

    

            cout<<power(2,n/2)%1000000007;

        }

        else cout<<0;

        

        

    

    

    

   

    return 0;

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

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

typedef long long ll;



ll mod_pow(ll x,ll n,ll mod){

	ll res=1;

	while(n>0){

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

		x=x*x%mod;

		n>>=1;

	}

	return res;

}

int a[100005];

int main()

{

	int n;

	ll mod=1000000000+7;

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

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

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

		sort(a,a+n);

		int flag=1;

		if(n%2==1){

			if(n==1){

				if(a[0]==0){

					

				}else{

					flag=0;

				}

			}

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

				if(i%2==1){

					if(a[i]==a[i-1]+2){

						

					}else{

						flag=0;

					}

				}else{

					if(a[i]==a[i-2]+2){

						

					}else{

						flag=0;

					}

				}

			}

		}else{

			if(a[0]!=a[1]) flag=0;

			if(a[0]!=1) flag=0;

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

				if(i%2==0){

					if(a[i]==a[i-1]+2){

						

					}else{

						flag=0;

					}

				}else{

					if(a[i]==a[i-2]+2){

						

					}else{

						flag=0;

					}

				}

			}

			

		}

		ll l=n/2;

		if(flag==0){

			printf("0\n");

		}else{

			printf("%lld\n",mod_pow(2,l,mod));

			

			

			

		}

	}

	

	return 0;

}

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

#include <cstring>

#include <cmath>

#include <algorithm>

typedef long long LL;

using namespace std;



const LL mod = 1e9 + 7;

const int MAXN = 1e5 + 10;

int a[MAXN];

char str[MAXN];



LL solve(int cnt) {

	LL ans = 1;

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

		ans *= 2;

		ans %= mod;	

	}

	return ans;

}



int main() {

	int n, ans = 0;

	scanf("%d", &n);

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

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

		if(a[i] == 0) ans++;

	}

	if(ans > 1 || ans && n % 2 == 0 || !ans && n % 2) {

		puts("0");

		return 0;

	}

	sort(a, a + n);

	int cnt = unique(a, a + n) - a;

	if(n % 2) {

		if(cnt - 1 != n / 2) puts("0");

		else printf("%lld\n", solve(cnt - 1) % mod);

	}

	else {

		if(cnt != n / 2) puts("0");

		else printf("%lld\n", solve(cnt) % mod);

	}

	return 0;

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

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

typedef long long ll;



ll mod_pow(ll x,ll n,ll mod){

	ll res=1;

	while(n>0){

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

		x=x*x%mod;

		n>>=1;

	}

	return res;

}

int a[100005];

int main()

{

	int n;

	ll mod=1000000000+7;

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

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

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

		sort(a,a+n);

		int flag=1;

		if(n%2==1){

			if(n==1){

				if(a[0]==0){

					

				}else{

					flag=0;

				}

			}

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

				if(i%2==1){

					if(a[i]==a[i-1]+2){

						

					}else{

						flag=0;

					}

				}else{

					if(a[i]==a[i-2]+2){

						

					}else{

						flag=0;

					}

				}

			}

		}else{

			if(a[0]!=a[1]) flag=0;

			if(a[0]!=1) flag=0;

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

				if(i%2==0){

					if(a[i]==a[i-1]+2){

						

					}else{

						flag=0;

					}

				}else{

					if(a[i]==a[i-2]+2){

						

					}else{

						flag=0;

					}

				}

			}

			

		}

		ll l=n/2;

		if(flag==0){

			printf("0\n");

		}else{

			printf("%lld\n",mod_pow(2,l,mod));

			

			

			

		}

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.204656036473064x):
//快速幂,2^n

#include<cstdio>

#define MOD 1000000007

long long fast(int a,int b)

{

	long long ans=1,x=a;

	while(b)

	{	

		if(b&1)     //奇数 

		{

			ans=(ans*x)%MOD;

		}

		x=(x*x)%MOD;

		b=b/2;

	}

	return ans;

 }	

int vis[100000+5];

int main()

{

	long long n,flag=0;

	scanf("%lld",&n);

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

	{

		int x;

		scanf("%d",&x);

		vis[x]++;

	}

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

	{

		if(vis[i]==0||vis[i]==2)

		{

			continue;

		}

		else

		{

			flag=1;

		}

	}

	if(n%2==0&&vis[0]!=0)

	{

		flag=1;

	}

	if(n%2==1&&vis[0]!=1)

	{

		flag=1;

	}

	if(flag)

	printf("0\n");

	else

	{

		n=n/2;

		long long ans=fast(2,n);

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

	 } 

	return 0;

//	long long a,b;

//	scanf("%lld%lld",&a,&b);

//	printf("%lld\n",fast(a,b));

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

using namespace std;

int a[100500];

int N;

long long int ans;

int main()

{

        scanf("%d",&N);

        int n;

        ans=1;

        memset(a,0,sizeof(a));

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

        {

            scanf("%d",&n);

            a[n]++;

            if(n==0&&a[n]==1)

            {

                ans*=1;

            }

            else if(n==0&&a[n]>1)

            {

                ans=0;

                break;

            }

            else if(a[n]==1)

            {

                ans*=2;

            }

            else if(a[n]>2)

            {

                ans=0;

                break;

            }

            ans%=1000000007;

        }

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

        return 0;

}


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

#include<cstring>

typedef long long LL;

LL mod=1e9+7;

LL ppower(LL s)

{

	LL r=1,a=2;

	while(s)

	{

		if(s&1) r=r*a%mod;

			a=a*a%mod;

			s=s>>1;

	}

	return r;

}

int main()

{

	LL a[100005],n,m,resu;

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

	{

		memset(a,0,sizeof(a));

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

		{

			scanf("%lld",&m);

			a[m]++;

		}

		LL flag=0;

		if(n&1)

		{

			if(a[0]>1)

				flag=1;

			else

			{

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

				{

					if(a[i]>2||a[i]==1)

						flag=1;

					if(flag)

						break;

				}

			}

			if(!flag)

				resu=ppower(n/2) ;

		}

		else

		{

			if(a[0]>0)

				flag=1;

			else

			{

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

				{

					if(a[i]>2||a[i]==1)

						flag=1;

					if(flag)

						break;

				}

			}

			if(!flag)

				resu=ppower(n/2) ;

		}

		if(flag) printf("0\n");

		else printf("%lld\n",resu);

	}

	return 0;

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

using namespace std;

typedef unsigned long long ll;

const int maxn=1e5+10;

const ll mm=1e9+7;

int sp[maxn],vis[maxn];

int main()

{

    int n;

    cin>>n;

    int flag=0;

    memset(vis,0,sizeof(vis));

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

        cin>>sp[i];

        vis[sp[i]]++;

    }

    if(n%2==1)

    {

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

        {

            if(i==0)

            {

                if(vis[i]!=1)

                {

                    flag=1;

                    break;

                }

            }

            else

            {

                if(vis[i]!=2)

                {

                    flag=1;

                    break;

                }

            }

        }

        if(flag==1)

            cout<<0<<endl;

        else

        {

            ll res=1;

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

            {

                res=((res%mm)*2)%mm;

            }

          //  ll ans=res%mm;

            cout<<res<<endl;

        }

    }

    else if(n%2==0)

    {

        int flag=0;

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

        {

            if(vis[i]!=2)

            {

                flag=1;

                break;

            }

        }

        if(flag==0)

        {

            ll res=1;

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

            {

                res=((res%mm)*2)%mm;

            }

          //  ll ans=res%mm;

            cout<<res<<endl;

        }



        else cout<<0<<endl;

    }

    return 0;

}


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

#include<cstring>

typedef long long LL;

LL mod=1e9+7;

LL ppower(LL s)

{

	LL r=1,a=2;

	while(s)

	{

		if(s&1) r=r*a%mod;

			a=a*a%mod;

			s=s>>1;

	}

	return r;

}

int main()

{

	LL a[100005],n,m,resu;

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

	{

		memset(a,0,sizeof(a));

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

		{

			scanf("%lld",&m);

			a[m]++;

		}

		LL flag=0;

		if(n&1)

		{

			if(a[0]>1)

				flag=1;

			else

			{

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

				{

					if(a[i]>2||a[i]==1)

						flag=1;

					if(flag)

						break;

				}

			}

			if(!flag)

				resu=ppower(n/2) ;

		}

		else

		{

			if(a[0]>0)

				flag=1;

			else

			{

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

				{

					if(a[i]>2||a[i]==1)

						flag=1;

					if(flag)

						break;

				}

			}

			if(!flag)

				resu=ppower(n/2) ;

		}

		if(flag) printf("0\n");

		else printf("%lld\n",resu);

	}

	return 0;

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

using namespace std;

int a[100500];

int N;

long long int ans;

int main()

{

        scanf("%d",&N);

        int n;

        ans=1;

        memset(a,0,sizeof(a));

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

        {

            scanf("%d",&n);

            a[n]++;

            if(n==0&&a[n]==1)

            {

                ans*=1;

            }

            else if(n==0&&a[n]>1)

            {

                ans=0;

                break;

            }

            else if(a[n]==1)

            {

                ans*=2;

            }

            else if(a[n]>2)

            {

                ans=0;

                break;

            }

            ans%=1000000007;

        }

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

        return 0;

}


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

using namespace std;



const long long MOD = 1e9 + 7;



long long pow_mod(int a, int n)

{

    if(!n)

        return 1;

    long long res = pow_mod(a, n / 2);

    res = res * res;

    res %= MOD;

    if(n % 2) 

        res *= a;

    res %= MOD;

    return res;

}



int main()

{

    int n;

    while(cin >> n)

    {

        vector<int> v(n + 1), cnt(n + 1);

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

        {

            cin >> v[i];

            cnt[abs((i - 1) - (n - i))] ++;

        }

        bool ok = true;

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

        {

            if(!cnt[v[i]])

            {

                ok = false;

                break;

            }

            cnt[v[i]] --;

        }

        if(!ok)

            cout << 0 << endl;

        else

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

    }

}