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

#include <cmath>

#include <stdio.h>

#include <algorithm>

#include <string>

#include <vector>

#include <queue>

#include <deque>

#include <stack>

#include <map>

#include <set>

#include <cstring>



using namespace std;



#define f first

#define s second

#define pb push_back

#define mp make_pair

#define ll long long

#define pii pair < int, int >

#define pll pair < long long, long long>

#define ull unsigned long long

#define vi vector < int >

#define vll vector < long long >

#define sz(a) (int)a.size()

#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)

#define all(a) a.begin(), a.end()

#define sqr(x) ((x) * (x))

#define fname "searching"



const int inf = (int)1e9;

const ll INF = (ll)1e18;

const double eps = 1e-9;

const double pi = acos(-1.0);

const int mod = (int)1e9 + 7;



int n;

int a[100100];

int ans;



int solve(){

    cin >> n;

    for(int i = 0; i < n; ++i) cin >> a[i];

    sort(a, a + n);

    if(a[0] != (n % 2 == 0)) return 0;

    int st = n % 2 == 0 ? 2 : 1;

    for(int i = n % 2, st = 2 - !(n % 2); i < n; i += 2, st += 2){

        if(a[i] == st && a[i + 1] == st) continue;

        else return 0;

    }

    

    ans = 1;

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

        ans *= 2;

        ans %= mod;

    }

    return ans;

}



int main(){

    ios_base::sync_with_stdio(0);

    cin.tie(0);



    cout << solve() << "\n";

    

    return 0;

}