#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
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;
}
bool flag=0;
int cnt[100100];
int main()
{
    int n;
    cin>>n;
    int x;
    if(n%2)
    {
        cnt[0]=1;
        for(int i=0;i<n;i++)
        {
            cin>>x;
            if(flag)continue;
            if(x>n||x%2||(++cnt[x/2])>2){flag=1;continue;}
        }
        if(flag)cout<<0<<endl;
        else cout<<quickmod(2,n/2,mod)<<endl;
    }else
    {
        for(int i=0;i<n;i++)
        {
            cin>>x;
            if(flag)continue;
            if(x>=n||!(x%2)||(++cnt[x/2])>2){flag=1;continue;}
        }
        if(flag)cout<<0<<endl;
        else cout<<quickmod(2,n/2,mod)<<endl;
    }
    return 0;
}
