stablegradients/pie-gem5-pairs huggingface dataset:
// 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.8995795086023937x):
#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));

	}

}
// 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.3836603448822988x):
#include <bits/stdc++.h>



using namespace std;



const int MOD = 1e9 + 7, maxn = 1e5 + 500;

int a[maxn], cnt[maxn];



int main(){

    ios_base::sync_with_stdio(false);

    int n;

    cin >> n;

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

        cin >> a[i];

        cnt[a[i]] ++;

    }

    if (n % 2 == 0){

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

            if (cnt[i] != 2){

                cout << 0 << endl;

                return 0;

            }

        }

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

            if (cnt[i] > 0){

                cout << 0 << endl;

                return 0;

            }

        }

        long long k = 1;

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

            k *= 2;

            k %= MOD;

        }

        cout << k << endl;

        return 0;

    }

    else {

        if (cnt[0] != 1){

            cout << 0 << endl;

            return 0;

        }

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

            if (cnt[i] != 2){

                cout << 0 << endl;

                return 0;

            }

        }

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

            if (cnt[i] > 0){

                cout << 0 << endl;

                return 0;

            }

        }

        long long k = 1;

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

            k *= 2;

            k %= MOD;

        }

        cout << k << 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.78280781725286x):
#include <bits/stdc++.h>



using namespace std;



const int MOD = 1e9 + 7, maxn = 1e5 + 500;

int a[maxn], cnt[maxn];



int main(){

    ios_base::sync_with_stdio(false);

    int n;

    cin >> n;

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

        cin >> a[i];

        cnt[a[i]] ++;

    }

    if (n % 2 == 0){

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

            if (cnt[i] != 2){

                cout << 0 << endl;

                return 0;

            }

        }

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

            if (cnt[i] > 0){

                cout << 0 << endl;

                return 0;

            }

        }

        long long k = 1;

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

            k *= 2;

            k %= MOD;

        }

        cout << k << endl;

        return 0;

    }

    else {

        if (cnt[0] != 1){

            cout << 0 << endl;

            return 0;

        }

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

            if (cnt[i] != 2){

                cout << 0 << endl;

                return 0;

            }

        }

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

            if (cnt[i] > 0){

                cout << 0 << endl;

                return 0;

            }

        }

        long long k = 1;

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

            k *= 2;

            k %= MOD;

        }

        cout << k << 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.4015839083252117x):
#include<bits/stdc++.h>



using namespace std;



int a[100000] , b, n, ans, line[100001];



int main(){

	cin >> n;

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

		cin >> a[i];

		line[a[i]]++;

	}

	ans = 1;

	if(n % 2 == 1){

		if(line[0] == 1){

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

				if(line[i] != 2){

					cout << 0;

					return 0;

				}

				b++;

			}

		}

		else{

			cout << 0;

			return 0;

		}

	}

	else{

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

            if(line[i] != 2){

                cout << 0;

                return 0;

            }

            b++;

			}

	}

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

		ans = 2 * ans;

		ans = ans % 1000000007;

	}

	cout << ans % 1000000007;

}
// 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.8058984075332472x):
#include<bits/stdc++.h>



using namespace std;



int a[100000] , b, n, ans, line[100001];



int main(){

	cin >> n;

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

		cin >> a[i];

		line[a[i]]++;

	}

	ans = 1;

	if(n % 2 == 1){

		if(line[0] == 1){

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

				if(line[i] != 2){

					cout << 0;

					return 0;

				}

				b++;

			}

		}

		else{

			cout << 0;

			return 0;

		}

	}

	else{

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

            if(line[i] != 2){

                cout << 0;

                return 0;

            }

            b++;

			}

	}

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

		ans = 2 * ans;

		ans = ans % 1000000007;

	}

	cout << ans % 1000000007;

}
// 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.4221479224870948x):
#include<bits/stdc++.h>

#define ll long long

#define mo 1000000007

using namespace std;

int n,x,ans=1;

int cnt[100005],a[100005];

int main(){

	scanf("%d",&n);

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

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

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

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

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

		if (cnt[i]^a[i])

			return puts("0"),0;

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

		if (cnt[i]) ans=ans*cnt[i]%mo;

	printf("%d",ans); 

}
// 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.832483806538735x):
#include<bits/stdc++.h>

#define ll long long

#define mo 1000000007

using namespace std;

int n,x,ans=1;

int cnt[100005],a[100005];

int main(){

	scanf("%d",&n);

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

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

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

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

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

		if (cnt[i]^a[i])

			return puts("0"),0;

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

		if (cnt[i]) ans=ans*cnt[i]%mo;

	printf("%d",ans); 

}
// 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.3811536955806298x):
#include<bits/stdc++.h>

#define int long long

#define mod 1000000007

using namespace std;



int n;



signed main()

{

	cin>>n;

	vector<int> a(n),b(n);

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

	{

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

		b[i]=abs(i-(n-i-1));

	}

	sort(a.begin(),a.end());

	sort(b.begin(),b.end());

	if(a!=b)

	{

		cout<<0<<endl;

		return 0;

	}

	long long ans=1ll;

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

	{

		ans*=2;

		ans%=mod;

	}

	cout<<ans<<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.7796955942278607x):
#include<bits/stdc++.h>

#define int long long

#define mod 1000000007

using namespace std;



int n;



signed main()

{

	cin>>n;

	vector<int> a(n),b(n);

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

	{

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

		b[i]=abs(i-(n-i-1));

	}

	sort(a.begin(),a.end());

	sort(b.begin(),b.end());

	if(a!=b)

	{

		cout<<0<<endl;

		return 0;

	}

	long long ans=1ll;

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

	{

		ans*=2;

		ans%=mod;

	}

	cout<<ans<<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.3987540379361794x):
#include<bits/stdc++.h>

#define ll long long

#define N 100100

#define M 1000000007

using namespace std;



ll n,num[N],x,ans,cnt[N];



int main()

{

	ll i,j,p,q;

	cin>>n;

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

	{

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

		cnt[num[i]]++;

	}

	if(n%2)

	{

		if(cnt[0]!=1)

		{

			cout<<0;

			return 0;

		}

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

		{

			if(cnt[i]!=2)

			{

				cout<<0;

				return 0;

			}

		}

	}

	else

	{

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

		{

			if(cnt[i]!=2)

			{

				cout<<0;

				return 0;

			}

		}

	}

	ll ans=1;

	for(i=1;i<=n/2;i++) ans=ans*2%M;

	cout<<ans;

}
// 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.8023746427995733x):
#include<bits/stdc++.h>

#define ll long long

#define N 100100

#define M 1000000007

using namespace std;



ll n,num[N],x,ans,cnt[N];



int main()

{

	ll i,j,p,q;

	cin>>n;

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

	{

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

		cnt[num[i]]++;

	}

	if(n%2)

	{

		if(cnt[0]!=1)

		{

			cout<<0;

			return 0;

		}

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

		{

			if(cnt[i]!=2)

			{

				cout<<0;

				return 0;

			}

		}

	}

	else

	{

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

		{

			if(cnt[i]!=2)

			{

				cout<<0;

				return 0;

			}

		}

	}

	ll ans=1;

	for(i=1;i<=n/2;i++) ans=ans*2%M;

	cout<<ans;

}
// 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.2878974098756304x):
#include<iostream>

#include<algorithm>

#include<string>

#include<cmath>



using namespace std;



int main() {

  int n;

  cin >> n;

  int cnt[100100] = {};

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

    int A;

    cin >> A;

    cnt[A]++;

  }



  int num = 0;

  if(n%2==0) {

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

      if (cnt[i] != 2) {

        cout << 0 << endl;

        return 0;

      }

      num++;

    }

  } else {

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

      if (i == 0) {

        if (cnt[i] != 1) {

          cout << 0 << endl;

          return 0;

        }

      } else {

        if (cnt[i] != 2) {

          cout << 0 << endl;

          return 0;

        }

      }

      num++;

    }

    num--;

  }



  long long ans = 1;

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

    ans *= 2;

    ans %= 1000000007;

  }



  cout << ans << endl;

  return 0;

}
// Slower C++ solution:
# 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;

 } 

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

#include<algorithm>

using namespace std;

const int mod=1e9+7;

int num[100005],a[100005];

void init(int x)

{

    if(x%2==0)

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

        {

            a[i]=i;

            a[i+1]=a[i];

        }

    else

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

        {

            a[i]=i;

            a[i+1]=a[i];

        }



}

int main()

{

    int n,k=1;

    scanf("%d",&n);

    init(n);

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

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

    sort(num+1,num+1+n);

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

        if(a[i]!=num[i])

        {

            printf("0");

            return 0; 

        }



    long long ans=1;

    n/=2;

    while(n--)

        ans=ans*2%mod;

    printf("%lld",ans);

    return 0;

}