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

#include <cstring>

#include <cstdlib>

#include <cstdio>

#include <algorithm>

#include <cmath>

#include <iomanip>

#include <vector>

using namespace std;

const int maxn = 1e5+100;

const int MOD = 1e9+7;

const double Pi = 3.141592654;

typedef long long ll;

typedef unsigned long long ull;





int main()

{

    int n;

    cin >> n;

    int a[maxn];

    int vis[maxn];

    int st;

    ll ans = 1;

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

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

    {

        cin >> a[i];

        vis[a[i]] ++;

    }

    if(!(n%2))//even

    {

        if(vis[0])

        {

            cout << 0 << endl;

            return 0;

        }

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

        {

            ans = (ans%MOD)*2%MOD;

            if(vis[i] != 2)

        {

            cout << 0 << endl;

            return 0;

        }

        }

    }

    else

    {

        if(vis[0] != 1)

        {

            cout << 0 << endl;

            return 0;

        }

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

        {

            ans = (ans%MOD)*2%MOD;

            if(vis[i] != 2)

        {

            cout << 0 << endl;

            return 0;

        }

        }

    }

    cout << ans << endl;



}



//9(4(7(1)(2))(3(6)(8)))(5(10)(11(12)))


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

#include<iostream>

#include<algorithm>

#include<cstring>

#include<cmath>

#include<vector>

#include<string>

#include<queue>

#include<stack>

#include<set>

#include<map>

#include<sstream>

#include<bitset>

using namespace std;

#define pii pair<int,int>

#define pdd pair<double,double>

#define mp make_pair

#define pb push_back

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

#define fst first

#define sec second

#define PQ priority_queue

typedef long long ll;

const double eps = 1e-6;

const int maxn=1e6+10;;

const int inf=0x3f3f3f3f;

const ll mod=1e9+7;

const double pi=acos(-1.0);

ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;} 

ll quickmod(ll a,ll b,ll c)

{

  ll res=1;

  while (b)

  {

    if(b&1) res=res*a%c;

    a=a*a%c;

    b>>=1;

  }

  return res;

  

}

ll vis[maxn],vis2[maxn],tem;

int a[maxn];

int main() {

    int n,flag=0;

    cin>>n;

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

    {

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

       vis[a[i]]++;

       if(vis[0]>=2) {flag=1;break;}

       if(a[i]>0&&vis[a[i]]>=3) {flag=1;break;}

       if(vis[a[i]]==2&&vis2[a[i]]==0) {tem++;vis2[a[i]]=1;}

    }

    if(flag) cout<<0<<endl;

    else

    {

      ll ans=quickmod(2,tem,mod);

      cout<<ans<<endl;

    }

    

    return 0;

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

#include<cmath>

#include<algorithm>

#include<cstdio>

#include<stack>

#include<queue>

#include<map>

#include<cstring>



using namespace std;



const int MAX=1e5+10;



int a[MAX];

int p[MAX];



long long mod_exp(int b){

	long long res,t;

	res=1;

	t=2;

	while(b){

		if(b&1){

			res=res*t%1000000007;

		}

		t=t*t%1000000007;

		b>>=1;

	}

	return res;

}



int main(){

	int n;

	cin>>n;

	memset(p,0,sizeof(p));

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

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

		p[a[i]]++;

	}

	int cnt=0;

	bool flag=true;

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

		if((n+a[i]+1)%2!=0||(n-a[i]+1)%2!=0||(p[0]!=1&&n%2==1)||(p[a[i]]!=2&&a[i]!=0)){

			cout<<"0"<<endl;

			flag=false;

			break;

		}

		if(p[i]==2)

		cnt++;

	}

	if(flag)

	cout<<mod_exp(cnt)<<endl;

	return 0;

}

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

#define EPS 1e-9

#define PI acos(-1)

using namespace std;

typedef long long ll;

const int mod = 1e9+7;

const int maxn = 1e5+100;

int a[maxn];



ll quick_pow(ll a,ll b)

{

    ll res = 1;

    while(b)

    {

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

        a = (a*a)%mod;

        b >>= 1;

    }

    return res;

}



int main()

{

    ios::sync_with_stdio(false);

    int n;

    cin>>n;

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

    {

        int num;

        cin>>num;

        a[num]++;

    }

    int ok = 1;

    if(n%2)//奇数

    {

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

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

        {

            if(i%2==1&&a[i]>0) ok = 0;

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

        }

    }

    else

    {

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

        {

            if(i%2==0&&a[i]>0) ok = 0;

            if(i%2==1&&a[i]!=2) ok = 0;

        }

    }

    if(!ok)

    {

        cout<<"0"<<"\n";

    }

    else

    {

//        ll sum = 1;

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

//        {

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

//        }

//        cout<<sum<<"\n";

        cout<<quick_pow(2,n/2)<<"\n";

    }

}
// Slower C++ solution:


#include<bits/stdc++.h>

using namespace std;



long long con=1000000007,a[100070],cnt[100070],fac[100050];



long long fact(long long n)

{

    if(n==0)

    {

        return 1;

    }

    long long mul=1,i;



    mul=fac[n-1]*n;

    mul=mul%con;



    return mul;

}



int main()

{



    long long n,i,ans=1;



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

    {

        fac[i]=fact(i);

    }

    scanf("%lld",&n);



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

    {

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

        cnt[a[i]]++;

    }



    for(i=1;i<100050; i++)

    {

        if(cnt[i]%2!=0)

        {

            printf("0");

            return 0;

        }





        ans*=fac[cnt[i]];

        ans=ans%con;

    }



    printf("%lld",ans);

    return 0;

}




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

#define EPS 1e-9

#define PI acos(-1)

using namespace std;

typedef long long ll;

const int mod = 1e9+7;

const int maxn = 1e5+100;

int a[maxn];



ll quick_pow(ll a,ll b)

{

    ll res = 1;

    while(b)

    {

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

        a = (a*a)%mod;

        b >>= 1;

    }

    return res;

}



int main()

{

    ios::sync_with_stdio(false);

    int n;

    cin>>n;

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

    {

        int num;

        cin>>num;

        a[num]++;

    }

    int ok = 1;

    if(n%2)//奇数

    {

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

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

        {

            if(i%2==1&&a[i]>0) ok = 0;

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

        }

    }

    else

    {

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

        {

            if(i%2==0&&a[i]>0) ok = 0;

            if(i%2==1&&a[i]!=2) ok = 0;

        }

    }

    if(!ok)

    {

        cout<<"0"<<"\n";

    }

    else

    {

//        ll sum = 1;

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

//        {

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

//        }

//        cout<<sum<<"\n";

        cout<<quick_pow(2,n/2)<<"\n";

    }

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

#include <cstring>

#include <cstdlib>

#include <cstdio>

#include <algorithm>

#include <cmath>

#include <iomanip>

#include <vector>

using namespace std;

const int maxn = 1e5+100;

const int MOD = 1e9+7;

const double Pi = 3.141592654;

typedef long long ll;

typedef unsigned long long ull;





int main()

{

    int n;

    cin >> n;

    int a[maxn];

    int vis[maxn];

    int st;

    ll ans = 1;

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

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

    {

        cin >> a[i];

        vis[a[i]] ++;

    }

    if(!(n%2))//even

    {

        if(vis[0])

        {

            cout << 0 << endl;

            return 0;

        }

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

        {

            ans = (ans%MOD)*2%MOD;

            if(vis[i] != 2)

        {

            cout << 0 << endl;

            return 0;

        }

        }

    }

    else

    {

        if(vis[0] != 1)

        {

            cout << 0 << endl;

            return 0;

        }

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

        {

            ans = (ans%MOD)*2%MOD;

            if(vis[i] != 2)

        {

            cout << 0 << endl;

            return 0;

        }

        }

    }

    cout << ans << endl;



}



//9(4(7(1)(2))(3(6)(8)))(5(10)(11(12)))


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

#define EPS 1e-9

#define PI acos(-1)

using namespace std;

typedef long long ll;

const int mod = 1e9+7;

const int maxn = 1e5+100;

int a[maxn];



ll quick_pow(ll a,ll b)

{

    ll res = 1;

    while(b)

    {

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

        a = (a*a)%mod;

        b >>= 1;

    }

    return res;

}



int main()

{

    ios::sync_with_stdio(false);

    int n;

    cin>>n;

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

    {

        int num;

        cin>>num;

        a[num]++;

    }

    int ok = 1;

    if(n%2)//奇数

    {

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

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

        {

            if(i%2==1&&a[i]>0) ok = 0;

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

        }

    }

    else

    {

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

        {

            if(i%2==0&&a[i]>0) ok = 0;

            if(i%2==1&&a[i]!=2) ok = 0;

        }

    }

    if(!ok)

    {

        cout<<"0"<<"\n";

    }

    else

    {

//        ll sum = 1;

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

//        {

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

//        }

//        cout<<sum<<"\n";

        cout<<quick_pow(2,n/2)<<"\n";

    }

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

#include<cmath>

#include<algorithm>

#include<cstdio>

#include<stack>

#include<queue>

#include<map>

#include<cstring>



using namespace std;



const int MAX=1e5+10;



int a[MAX];

int p[MAX];



long long mod_exp(int b){

	long long res,t;

	res=1;

	t=2;

	while(b){

		if(b&1){

			res=res*t%1000000007;

		}

		t=t*t%1000000007;

		b>>=1;

	}

	return res;

}



int main(){

	int n;

	cin>>n;

	memset(p,0,sizeof(p));

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

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

		p[a[i]]++;

	}

	int cnt=0;

	bool flag=true;

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

		if((n+a[i]+1)%2!=0||(n-a[i]+1)%2!=0||(p[0]!=1&&n%2==1)||(p[a[i]]!=2&&a[i]!=0)){

			cout<<"0"<<endl;

			flag=false;

			break;

		}

		if(p[i]==2)

		cnt++;

	}

	if(flag)

	cout<<mod_exp(cnt)<<endl;

	return 0;

}

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

using namespace std;

int p[100000]={0};

int main()

{

	long long n;

	int k;

	bool ok=1;

	cin>>n;

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

	{

		cin>>k;

		p[k]++;

	}

	if(n%2==0)

	{

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

		{

			if(p[i]!=2)

			{

				ok=0;

				break;

			}

		}

	}

	else

	{

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

			if(p[0]!=1||p[i]!=2)

			{

				ok=0;

				break;

			}

	}

	if(ok)

	{

		long long m=1;

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

			m=(m*2)%1000000007;

		cout<<m;

	}

	else

	    cout<<0;

	return 0;

}
// Slower C++ solution:


#include<bits/stdc++.h>

using namespace std;



long long con=1000000007,a[100070],cnt[100070],fac[100050];



long long fact(long long n)

{

    if(n==0)

    {

        return 1;

    }

    long long mul=1,i;



    mul=fac[n-1]*n;

    mul=mul%con;



    return mul;

}



int main()

{



    long long n,i,ans=1;



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

    {

        fac[i]=fact(i);

    }

    scanf("%lld",&n);



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

    {

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

        cnt[a[i]]++;

    }



    for(i=1;i<100050; i++)

    {

        if(cnt[i]%2!=0)

        {

            printf("0");

            return 0;

        }





        ans*=fac[cnt[i]];

        ans=ans%con;

    }



    printf("%lld",ans);

    return 0;

}




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

using namespace std;

int p[100000]={0};

int main()

{

	long long n;

	int k;

	bool ok=1;

	cin>>n;

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

	{

		cin>>k;

		p[k]++;

	}

	if(n%2==0)

	{

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

		{

			if(p[i]!=2)

			{

				ok=0;

				break;

			}

		}

	}

	else

	{

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

			if(p[0]!=1||p[i]!=2)

			{

				ok=0;

				break;

			}

	}

	if(ok)

	{

		long long m=1;

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

			m=(m*2)%1000000007;

		cout<<m;

	}

	else

	    cout<<0;

	return 0;

}
// Slower C++ solution:


#include <bits/stdc++.h>

using namespace std;



#define PB              push_back

#define MP              make_pair

#define xx              first

#define yy              second

#define abs(x)          ((x)<0?-(x):(x))

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

#define un(v)           (v).erase(unique((v).begin(),(v).end()),(v).end())

#define ITERATE(it, v)  for(__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)



typedef long long LL;

typedef pair <int, int> pii;



const LL oo = 2147383647;

const double pi = 2 * acos (0.0);

const double eps = 1e-9;



inline LL gcd(LL a, LL b) {

    a = abs(a); b = abs(b);

    while (b) { a = a % b; swap (a, b); } return a;

}



LL ext_gcd(LL A, LL B, LL *X, LL *Y) {

    LL x2, y2, x1, y1, x, y, r2, r1, q, r;

    x2 = 1; y2 = 0;

    x1 = 0; y1 = 1;

    for(r2 = A, r1 = B; r1 != 0; r2 = r1, r1 = r, x2 = x1, y2 = y1, x1 = x, y1 = y ) {

        q = r2 / r1;

        r = r2 % r1;

        x = x2 - (q * x1);

        y = y2 - (q * y1);

    }

    *X = x2; *Y = y2;

    return r2;

}



inline LL modInv(LL a, LL m) {

    LL x, y;

    ext_gcd(a, m, &x, &y);

    x %= m;

    if ( x < 0 ) x += m; //modInv is never negative

    return x;

}



inline LL power(LL a, LL p) {

    LL res = 1, x = a;

    while (p) {

        if (p & 1) res = (res * x);

        x = (x * x); p >>= 1;

    }

    return res;

}



inline LL bigmod(LL a, LL p, LL m) {

    LL res = 1 % m, x = a % m;

    while (p) {

        if (p & 1) res = (res * x) % m;

        x = (x * x) % m; p >>= 1;

    }

    return res;

}



///<-------------------------------------------------END OF TEMPLATE-------------------------------------------------->



const int N = 100001;

int A[N], cnt[N];



int main() {

    int n;

    scanf("%d", &n);

    memset(cnt, 0, sizeof cnt);

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

        int x;

        scanf("%d", &x);

        cnt[x]++;

    }

    if(cnt[0] > 1) {

        printf("0\n");

        exit(0);

    }

    else {

        int x = 0;

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

            if(cnt[i] == 0) continue;

            if(cnt[i] > 2) {

                printf("0\n");

                exit(0);

            }

            if(cnt[i] == 2) x++;

        }

        printf("%lld\n", bigmod(2, x, 1e9 + 7));

    }

    return 0;

}


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

using namespace std;

int p[100000]={0};

int main()

{

	long long n;

	int k;

	bool ok=1;

	cin>>n;

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

	{

		cin>>k;

		p[k]++;

	}

	if(n%2==0)

	{

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

		{

			if(p[i]!=2)

			{

				ok=0;

				break;

			}

		}

	}

	else

	{

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

			if(p[0]!=1||p[i]!=2)

			{

				ok=0;

				break;

			}

	}

	if(ok)

	{

		long long m=1;

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

			m=(m*2)%1000000007;

		cout<<m;

	}

	else

	    cout<<0;

	return 0;

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

#include <cstring>

#include <cstdlib>

#include <cstdio>

#include <algorithm>

#include <cmath>

#include <iomanip>

#include <vector>

using namespace std;

const int maxn = 1e5+100;

const int MOD = 1e9+7;

const double Pi = 3.141592654;

typedef long long ll;

typedef unsigned long long ull;





int main()

{

    int n;

    cin >> n;

    int a[maxn];

    int vis[maxn];

    int st;

    ll ans = 1;

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

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

    {

        cin >> a[i];

        vis[a[i]] ++;

    }

    if(!(n%2))//even

    {

        if(vis[0])

        {

            cout << 0 << endl;

            return 0;

        }

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

        {

            ans = (ans%MOD)*2%MOD;

            if(vis[i] != 2)

        {

            cout << 0 << endl;

            return 0;

        }

        }

    }

    else

    {

        if(vis[0] != 1)

        {

            cout << 0 << endl;

            return 0;

        }

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

        {

            ans = (ans%MOD)*2%MOD;

            if(vis[i] != 2)

        {

            cout << 0 << endl;

            return 0;

        }

        }

    }

    cout << ans << endl;



}



//9(4(7(1)(2))(3(6)(8)))(5(10)(11(12)))


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

using namespace std;

int p[100000]={0};

int main()

{

	long long n;

	int k;

	bool ok=1;

	cin>>n;

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

	{

		cin>>k;

		p[k]++;

	}

	if(n%2==0)

	{

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

		{

			if(p[i]!=2)

			{

				ok=0;

				break;

			}

		}

	}

	else

	{

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

			if(p[0]!=1||p[i]!=2)

			{

				ok=0;

				break;

			}

	}

	if(ok)

	{

		long long m=1;

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

			m=(m*2)%1000000007;

		cout<<m;

	}

	else

	    cout<<0;

	return 0;

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

#include<cmath>

#include<algorithm>

#include<cstdio>

#include<stack>

#include<queue>

#include<map>

#include<cstring>



using namespace std;



const int MAX=1e5+10;



int a[MAX];

int p[MAX];



long long mod_exp(int b){

	long long res,t;

	res=1;

	t=2;

	while(b){

		if(b&1){

			res=res*t%1000000007;

		}

		t=t*t%1000000007;

		b>>=1;

	}

	return res;

}



int main(){

	int n;

	cin>>n;

	memset(p,0,sizeof(p));

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

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

		p[a[i]]++;

	}

	int cnt=0;

	bool flag=true;

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

		if((n+a[i]+1)%2!=0||(n-a[i]+1)%2!=0||(p[0]!=1&&n%2==1)||(p[a[i]]!=2&&a[i]!=0)){

			cout<<"0"<<endl;

			flag=false;

			break;

		}

		if(p[i]==2)

		cnt++;

	}

	if(flag)

	cout<<mod_exp(cnt)<<endl;

	return 0;

}

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

#include <bits/stdc++.h>

using namespace std;



int main() {

	//cout<<"GfG!";

	long long int n, a[1000000], i, j, k, f = 1 ;

	unsigned long long int tot = 1, M = 1000000007;

	cin>>n;

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

	{

	    cin>>a[i]; 

	}

	sort(a, a + n);

	i = 0;  j = 0; 

	while (i < n)

	{

	    if (n == 1)

	    {   break;  }

	    else if (a[i] == 0 && a[i+1] != 0)

	    {

	        i++;   

	    }

	    else if (a[i] == 0 && a[i+1] == 0)

	    {       f = 0;  break;  }

	    else

	    {

	        if (i == n - 1)

	        {       f = 0;  break;  }

	        else if(a[i+1] == a[i] && (a[j+2] - a[j] == 2))

	        {

	            tot = (tot * 2) % M;

	            i += 2;   j += 2;   

	            if (j == n - 2)

	                j = 0;

	                

	        }

	        else

	        {

	            f = 0;  break;

	        }

	    }

	     

	}

	if (f)

	    cout<<tot;

	else

	    cout<<"0";

	return 0;

}
// Slower C++ solution:


#include<bits/stdc++.h>

using namespace std;



long long con=1000000007,a[100070],cnt[100070],fac[100050];



long long fact(long long n)

{

    if(n==0)

    {

        return 1;

    }

    long long mul=1,i;



    mul=fac[n-1]*n;

    mul=mul%con;



    return mul;

}



int main()

{



    long long n,i,ans=1;



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

    {

        fac[i]=fact(i);

    }

    scanf("%lld",&n);



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

    {

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

        cnt[a[i]]++;

    }



    for(i=1;i<100050; i++)

    {

        if(cnt[i]%2!=0)

        {

            printf("0");

            return 0;

        }





        ans*=fac[cnt[i]];

        ans=ans%con;

    }



    printf("%lld",ans);

    return 0;

}




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

#include <bits/stdc++.h>

using namespace std;



int main() {

	//cout<<"GfG!";

	long long int n, a[1000000], i, j, k, f = 1 ;

	unsigned long long int tot = 1, M = 1000000007;

	cin>>n;

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

	{

	    cin>>a[i]; 

	}

	sort(a, a + n);

	i = 0;  j = 0; 

	while (i < n)

	{

	    if (n == 1)

	    {   break;  }

	    else if (a[i] == 0 && a[i+1] != 0)

	    {

	        i++;   

	    }

	    else if (a[i] == 0 && a[i+1] == 0)

	    {       f = 0;  break;  }

	    else

	    {

	        if (i == n - 1)

	        {       f = 0;  break;  }

	        else if(a[i+1] == a[i] && (a[j+2] - a[j] == 2))

	        {

	            tot = (tot * 2) % M;

	            i += 2;   j += 2;   

	            if (j == n - 2)

	                j = 0;

	                

	        }

	        else

	        {

	            f = 0;  break;

	        }

	    }

	     

	}

	if (f)

	    cout<<tot;

	else

	    cout<<"0";

	return 0;

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

#include <cstring>

#include <cstdlib>

#include <cstdio>

#include <algorithm>

#include <cmath>

#include <iomanip>

#include <vector>

using namespace std;

const int maxn = 1e5+100;

const int MOD = 1e9+7;

const double Pi = 3.141592654;

typedef long long ll;

typedef unsigned long long ull;





int main()

{

    int n;

    cin >> n;

    int a[maxn];

    int vis[maxn];

    int st;

    ll ans = 1;

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

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

    {

        cin >> a[i];

        vis[a[i]] ++;

    }

    if(!(n%2))//even

    {

        if(vis[0])

        {

            cout << 0 << endl;

            return 0;

        }

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

        {

            ans = (ans%MOD)*2%MOD;

            if(vis[i] != 2)

        {

            cout << 0 << endl;

            return 0;

        }

        }

    }

    else

    {

        if(vis[0] != 1)

        {

            cout << 0 << endl;

            return 0;

        }

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

        {

            ans = (ans%MOD)*2%MOD;

            if(vis[i] != 2)

        {

            cout << 0 << endl;

            return 0;

        }

        }

    }

    cout << ans << endl;



}



//9(4(7(1)(2))(3(6)(8)))(5(10)(11(12)))


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

#include <bits/stdc++.h>

using namespace std;



int main() {

	//cout<<"GfG!";

	long long int n, a[1000000], i, j, k, f = 1 ;

	unsigned long long int tot = 1, M = 1000000007;

	cin>>n;

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

	{

	    cin>>a[i]; 

	}

	sort(a, a + n);

	i = 0;  j = 0; 

	while (i < n)

	{

	    if (n == 1)

	    {   break;  }

	    else if (a[i] == 0 && a[i+1] != 0)

	    {

	        i++;   

	    }

	    else if (a[i] == 0 && a[i+1] == 0)

	    {       f = 0;  break;  }

	    else

	    {

	        if (i == n - 1)

	        {       f = 0;  break;  }

	        else if(a[i+1] == a[i] && (a[j+2] - a[j] == 2))

	        {

	            tot = (tot * 2) % M;

	            i += 2;   j += 2;   

	            if (j == n - 2)

	                j = 0;

	                

	        }

	        else

	        {

	            f = 0;  break;

	        }

	    }

	     

	}

	if (f)

	    cout<<tot;

	else

	    cout<<"0";

	return 0;

}