// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define F first

#define S second

#define pii pair<int, int>

#define eb emplace_back

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

#define rep(i, n) for (int i = 0; i < (n); ++i)

#define rep3(i, l, n) for (int i = l; i < (n); ++i)

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

#define inf (int)(1e9+7)

#define abs(x) (x >= 0 ? x : -(x))

#define ceil(a, b) a / b + !!(a % b)

template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }

template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



int main() {

    int n;

    cin >> n;

    

    int table[100001] = {0};

    

    rep(i, n) {

        int a;

        cin >> a;

        table[a] += 1;

    }

    

    int flg = 0;

    if (n % 2 != 0) {

        if (table[0] != 1) flg = 1;

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

            if (table[i] != 2) flg = 1;

        }

    } else {

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

            if (table[i] != 2) flg = 1;

        }

    }

    

    if (flg == 1) {

        cout << 0 << endl;

        return 0;

    }

    

    ll ans = 1;

    rep(i, n / 2) {

        (ans *= 2) %= inf;

    }

    cout << ans << endl;

}




// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define F first

#define S second

#define pii pair<int, int>

#define eb emplace_back

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

#define rep(i, n) for (int i = 0; i < (n); ++i)

#define rep3(i, l, n) for (int i = l; i < (n); ++i)

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

#define inf (int)(1e9+7)

template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }

template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }













int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    

    

    

    int n;

    cin >> n;

    vector<int> a(n);

    rep(i, n) cin >> a[i];

    map<int, int> mp;

    rep(i, n) mp[a[i]]++;

    for (auto e : mp) {

        // cout << e.F << " " << e.S << endl;

        if (n % 2 != 0 && e.F == 0) {

            if (e.S != 1) {

                cout << 0 << endl;

                return 0;

            }

        } else if (e.S != 2) {

            cout << 0 << endl;

            return 0;

        }

    }

    int m = 0;

    int cnt = 0;

    ll ans = (n % 2 == 0 ? 2 : 1);

    for (auto e : mp) {

        if (cnt++ == 0) {

            m = e.F;

        } else {

            if (e.F != m + 2) {

                cout << 0 << endl;

                return 0;

            } else {

                (ans *= 2) %= inf;

            }

            m = e.F;

        }

        

    }

    cout << ans << endl;

}






// Fastest known solution for this problem: