// Author := Abhishek Giri

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define V(type) vector<(type)> 
#define all(c) ((c).begin(),(c).end())
#define in(var) cin>>(var)
#define out(var) cout<<(var)
#define on(var) cout<<var<<"\n"
#define f(i,n) for(ll i = 0 ; i < n ;i++)
#define mfor(i,init,n,b) for(ll i = (init) ; i < (n) ; i+= (b))
#define cfor(i,c) for(auto i = (c).begin() ; i!= (c).end(); i++)
#define el "\n"

/*##################################################################################*/

/*
int prime[10000000] = {0} ;
void calculateprime()
{
    //calculating primes
    prime[0] = prime[1] = 1 ;
    for(int i = 2 ; (ll)i*i <= 10000000 ; i++)
    {
        if(prime[i] == 0)
        {
            for(ll j = i*i ; j <= 10000000 ; j += i )
            {
                prime[j] = 1 ;
            }
        }
    }
}
*/
void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

bool isprime(ll n)
{
    for(ll i = 2 ; (ll) i*i <= n ; i++)
    {
        if(n % i == 0){
            return false;
        }
    }
    return true;
}

ll fib(int n) 
{ 
  ll a = 0, b = 1, c, i; 
  if( n == 0) 
    return a; 
  for (i = 2; i <= n; i++) 
  { 
    c = (a + b); 
    a = b; 
    b = c; 
  } 
  return b; 
}


ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 



ll findgrouplcm(vector<int> &arr, int n) 
{ 
    ll ans = arr[0]; 
  
    for (ll i = 1; i < n; i++) 
        ans = (arr[i] * (ans/(gcd(arr[i], ans))));
  
    return ans; 
}


ll powerwithmod(ll x, unsigned ll y, ll p)  
{  
    ll res = 1;    
  
    x = x % p; 
   
    if (x == 0) return 0;
  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
   
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}
 

bool comp(const pair<ll,ll> &a , const pair<ll,ll> &b){
    return a.first > b.first;
}

void solve(){
    int n;
    in(n);
    int arr[n];
    f(i,n)  in(arr[i]);
    if(n & 1){
        sort(arr,arr+n);
        if(arr[0] == 0){
            int i = 1 ;
            while(i < n ){
                int len = 0 ,num = arr[i];
                if(num != i+1){
                    out(0);
                    return;
                }
                while(arr[i] == num and i < n ){
                    ++len,++i;
                }
                if(len != 2){
                    out(0);
                    return;
                }
            }
            out(powerwithmod(2,n/2,mod));
        }
        else{
            out(0);
            return;
        }
    }
    else{
        sort(arr,arr+n);
        if(arr[0] == 1 and arr[1] == 1){
            int i = 2 ;
            while(i < n ){
                int len = 0 ,num = arr[i];
                if(num != i + 1){
                    out(0);
                    return;
                }
                while(arr[i] == num and i < n ){
                    ++len,++i;
                }
                if(len != 2){
                    out(0);
                    return;
                }
            }
            out(powerwithmod(2,n/2,mod));
        }
        else{
            out(0);
            return;
        }
    }
}

int main() {
    fast();
    ll t = 1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 640