// 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.4692436159445947x):
#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;

}