//                                ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
///==================================================///
///               !! HELLO WORLD !!                  ///
///                 >>IT'S ME<<                      ///
///               MOHAMMAD FAISAL                    ///
///==================================================///
//THIS CODE IS IMPLEMENTED BY DUGGU_123,bhai.Shahab78612(MOHAMMAD FAISAL)
// author: MOHAMMAD FAISAL (email: mohammad.faisal78612@gmail.com)
// Beginning with the name of ALMIGHTY GOD ALLAH SUBHANA-WATAA-A-ALLAH.
/*
MIT License
    Copyright (c) 2020 Mohammad Faisal <mohammad.faisal78612@gmail.com>
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.
*/
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-O3")
 
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//#include <ext/pb_ds/detail/standard_policies.hpp>
#include<iostream>
#include<cstdio>
#include<list>
#include<string>
#include<cstring>
#include<sstream>
#include<cctype>
#include<string.h>
#include<algorithm>
#include<cmath>
#include<stack>
#include<fstream>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<utility>
#include<iomanip>
#include<queue>
#include<deque>
#include<iterator>
#include<assert.h>
#include<bitset>
#include<climits>
#include<ctime>
#include<complex>
 
using namespace std ;
namespace io
{
    const int N=1<<20;
    char buf[N],*t1=buf,*t2=buf;
    #ifdef cjy
    #define getc getchar
    #else
    #define getc() t1==t2&&(t2=(t1=buf)+fread(buf,1,N,stdin),t1==t2)?EOF:*t1++
    #endif
    inline int read()
    {
        static int an;an=0;
        static char ch;ch=getc();
        while(ch<48||ch>57)ch=getc();
        while(ch>=48&&ch<=57)an=(an<<3)+(an<<1)+(ch^48),ch=getc();
        return an;
    }
}using io::read;
#define WorkingArea() int main(int argc, char **argv)
#define test() int t; cin >> t; while(t--)
#define ll long long
#define ull unsigned long long int
#define ld long double
#define lop(i,n) for(int i=0;i<n;i++)
#define rloop(i,n) for (int i = n-1; i >= 0; i--)
#define loop(x, n) for(ll x = 0; x < n; ++ x)
#define rep(x,n) for(ll x=1;x<=n;x++)
#define mp make_pair
#define pb push_back
#define I cin>>
#define O cout<<
#define W(x) while(x--)
#define si(x) scanf("%d",&x)
#define pi(x) printf("%d\n",x)
#define s(x) scanf("%lld",&x)
#define p(x) printf("%lld\n",x)
#define sc(x) scanf("%s",x)
#define pc(x) printf("%s",x)
#define out2(x, y) cout<< (x) << " " << (y) << endl
#define out3(x, y, z) cout<< (x) << " " << (y) << " " << (z) << endl
#define F first
#define S second
#define sz size()
#define re return
#define inf 1e18
#define MAX 10000000
#define M 1000000007
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define prec(x) fixed<<setprecision(15)<<x
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define fix(a, k) (ll(a) % ll(k) + k) % k  // Modulo Overflow Handling
#define magic ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define XXX return 0;
#define stringToLower(s)  transform(all(s), s.begin(), ::tolower);
#define stringToUpper(s)  transform(all(s), s.begin(), ::toupper);
#define noOfDigits(n)  (1+floor(log10(n)))
#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define lowBit(S) (S & (-S))
#define setAll(S, n) (S = (1 << n) - 1)
#define modulo(S, n) ((S) & (n - 1))   // returns S % n, where n is a power of 2
#define isPowerOfTwo(S) (!(S & (S - 1)))
#define nearestPowerOfTwo(S) ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))
#define turnOffLastBit(S) ((S) & (S - 1))
#define turnOnLastZero(S) ((S) | (S + 1))
#define turnOffLastConsecutiveBits(S) ((S) & (S + 1))
#define turnOnLastConsecutiveZeroes(S) ((S) | (S - 1))
#define posOfFirstSetBit(n) (log2(n & -n) + 1);
#define ARR(a,n) ll a[n];for(ll i=0;i<n;scanf("%ld ",&a[i++]));
#define ARR2D(a,n,m) ll a[n][m];for(ll i=0;i<n;i++)for(ll j=0;i<m;scanf("%ld ",&a[i][j++]));
#define SHOW2D(a,n,m) ll a[n][m];for(ll i=0;i<n;i++){for(ll j=0;i<m;printf("%ld ",a[i][j++]));printf("\n")}
#define SHOW(a,n) printf("\n");for(ll i=0;i<n;printf("%ld ",a[i++]));
#define br cout<<endl;
#define nl <<endl;
#define RESET(a,b)    memset(a,b,sizeof(a))
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define _abs(x, y) ((x>y)?(x-y):(y-x))
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
#define vc vector<char>
#define mii map<int,int>
#define mll map<ll,ll>
#define mic map<int,char>
#define mci map<char,int>
#define pii pair<int,int>
#define pll pair<ll,ll>
 /*
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
 */
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

typedef int8_t i8;
typedef uint8_t ui8;
typedef int16_t i16;
typedef uint16_t ui16;
typedef int32_t i32;
typedef uint32_t ui32;
typedef int64_t i64;
typedef uint64_t ui64;
 
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
//const ll inf = 1000000000;
//const ll MOD = 1000000007;
vector<bool> chkprime (MAX,true);
unsigned primearray[5761459];

const int monthly[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };

// Number Theory helper
ll GCD(ll a, ll b) { re((!b) ? a : GCD(b, a%b)); }
ll LCM(ll a, ll b) { return a / (GCD(a, b))*b; }
ll nCr(ll n, ll r) { if (n<r)return 0; if (r == 0)return 1; return n*nCr(n - 1, r - 1) / r; }



// Inverse Modulo helper
ll PowMod(ll bs, ll ex, ll Mod) { if (!ex)return 1; ll p = PowMod((bs*bs) % Mod, ex >> 1, Mod); re(ex & 1) ? (p*bs) % Mod : p; }
ll ModInverse(ll a) { return PowMod(a, M - 2, M); }


//template <typename T1, typename T2>
//struct less_second {
//    typedef pair<T1, T2> type;
//    bool operator ()(type const& a, type const& b) const {
//        return a.second < b.second;
//    }
//};
bool PointInRectangle(ll x1, ll y1, ll x2,
    ll y2, ll x, ll y) {
    return (x >= x1 && x <= x2 && y >= y1 && y <= y2);
}
// inline void input(int &n)
// {
//     register char c=getchar();
//     n=0;
//     for(;(c<'0'||c>'9');c=getchar());
//     for(;(c<='9'&&c>='0');c=getchar()){
//         n=n*10+c-48;
//     }
// }
string Letters = "0123456789ABCDEF";
int toInt(char c) { return Letters.find(c); }
ll FromAnyBaseToDecimal(string inp, int base) { ll res = 0;  lop(i,inp.sz) { res *= base; res += toInt(inp[i]); } return res; }
string FromDecimalToAnyBase(ll n, int base) { if (n == 0) return "0";  string ret = ""; while (n) { ret = Letters[n%base] + ret;  n /= base; } return ret; }

// Inline functions
// inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
// inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
// inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
// inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
// inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
// inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
// inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
// inline ll modInverse(ll a) { return modPow(a, MOD-2); }
// inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }
// inline bool isInside(pii p,ll n,ll m)    { return (p.first>=0&&p.first<n&&p.second>=0&&p.second<m); }
// inline bool isInside(pii p,ll n)        { return (p.first>=0&&p.first<n&&p.second>=0&&p.second<n); }
// inline bool isSquare(ll x)                 { ll s = sqrt(x);    return (s*s==x); }
// inline bool isFib(ll x)                 { return isSquare(5*x*x+4)|| isSquare(5*x*x-4); }
// inline bool isPowerOfTwo(ll x)            { return ((1LL<<(ll)log2(x))==x); }
double distance(double x1, double y1, double x2, double y2) { return hypot(fabs(x1 - x2), fabs(y1 - y2)); }
ll mult(ll a, ll b) { re(1LL * a * b) % M; }
ll SumOfOdd(ll l, ll r) { ll Rsm = (r + 1) / 2; Rsm *= Rsm; l--; ll Lsm = (l + 1) / 2; Lsm *= Lsm; return Rsm - Lsm; }
ll NoOfOdd(ll L, ll R) { ll n = (R - L) / 2; if (R % 2 != 0 || L % 2 != 0)n++; return n; }
ll NoOfEven(ll L, ll R) { re((R - L + 1) - NoOfOdd(L, R)); }
// //Bit Operations
// inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
// inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
// inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int extgcd(int a, int b, int &x, int &y) {
    int g = a;
    x = 1;
    y = 0;
    if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
    return g;
}
bool isPalindrome(string str) { ll l = 0; ll h = str.sz - 1; while (h > l) { if (str[l++] != str[h--]) { return 0; } } return 1; }
bool primity(long long n)
{
    if(n<=1)
        return false;
    if(n<=3)
        return true;
    
    if(n%2==0 || n%3==0)
        return false;
    
    for(auto i=5; i*i<=n; i+=6)
        if(n%i==0 || n%(i+2)==0)
            return false;
    
    return true;
}
int power_x(int x, unsigned y)
{
    if(y==0)
        return 1;
    if(!(y&1))
        return power_x(x,y>>1)*power_x(x,y>>1);
    return x*power_x(x,y>>1)*power_x(x,y>>1);
}
int sod(int n)
{
    int sum=0;
    while(n > 0)
    {
        sum+=n%10;
        n/=10;
    }
    return sum;
}
int order_x(long long x)
{
    int n=0;
    while(x)
    {
        n++;
        x/=10;
    }
    return n;
}
bool is_perfect_square(int n) {
    if (n < 0)
        return false;
    int root(round(sqrt(n)));
    return n == root * root;
}

bool is_perfect_cube(int n) {
    int root(round(cbrt(n)));
    return n == root * root * root;
}

/*bool isArm(long long n)
 {
 int pow=order_x(n);
 long long temp=n,sum=0;
 while(temp)
 {
 int r=temp%10;
 sum+=power_x(r,pow);
 temp/=10;
 }
 if(sum==n)
 return true;
 else
 return false;
 }*/

void n_primes(){
    chkprime[0]=chkprime[1]=false;
    for(unsigned i=2;i*i<=MAX;i++){
        if(chkprime[i]){
            for(unsigned j=i;j*i<=MAX;j++) chkprime[i*j]=false;
        }
    }
    unsigned id = 1;
    primearray[0]=2;
    
    for(int i=3;i<=MAX;i+=2){
        if(chkprime[i]){
            primearray[id++]=i;
        }
    }
}

//mt19937 gen(chrono::system_clock::now().time_since_epoch().count());


WorkingArea()
{
    /*
    
           _/ _/ _/ _/  _/ _/ _/ _/   _/  _/ _/ _/   _/ _/ _/ _/  _/
          _/           _/       _/   _/  _/         _/       _/  _/
         _/ _/ _/     _/ _/ _/ _/   _/  _/ _/ _/   _/ _/ _/ _/  _/
        _/           _/       _/   _/        _/   _/       _/  _/
       _/           _/       _/   _/  _/ _/ _/   _/       _/  _/ _/ _/ _/
    
    */
//    clock_t begin = clock();
    magic;
//    #ifdef LOCAL
//        freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
//    #else
    /*
     
     O
    <C>
     /\
     
     */
//    test()
//    {
//
//    }
    int n;
    I n;
    mii lis;
    int a,zero=0;
    lop(i,n)
    {
        I a;
        lis[a]++;
        if(a==0)
            zero++;
    }
    
    if(zero>=2)
    {
        O "0";
        XXX
    }
    
    if(n&1)
    {
        if(lis.sz==(n>>1)+1)
            O PowMod(2, n>>1, M);
        else
            O "0";
    }
    else{
        if(lis.sz==(n>>1))
            O PowMod(2, n>>1, M);
        else
            O "0";
    }
    
    
//    cout<<"\n\nDebugging Portion\n";
//    clock_t end = clock();
//    double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
//    cerr<<"Running Time: "<<time_spent<<" Seconds"<<endl;
    XXX
}



Measured memory_bytes: 6528