#include <iostream>
#include <iomanip>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>
#include <numeric>
#include <bitset>
#include <cstdint>
#include <stdexcept>
using namespace std;

// 整数型
using ll = int_fast64_t;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
// [0,n)を昇順/降順でループ
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
#define repd(i, n) for (int i = static_cast<int>(n) - 1; i >= 0; --i)
// [a,b)を昇順/降順でループ
#define FOR(i, a, b) for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define FORD(i, a, b) for (int i = static_cast<int>(b) - 1; i >= static_cast<int>(a); --i)

// デバッグ
#ifdef DEBUG
#include <cassert>
#define my_assert(x) assert(x)
#else
#define my_assert(x)
#endif

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

template <u32 p>
struct mint
{
    // p は素数
    static_assert(1 < p, "p must be greater than 1");

private:
    // [0,p)内の値
    u32 data;

public:
    // safe
    constexpr mint(u32 const x = 0) noexcept
        : data(((x % p) + p) % p) {}

    // unsafe
    constexpr mint(u32 const x, bool const) noexcept
        : data(x) {}

    constexpr u32 const &val() const noexcept
    {
        return data;
    }

    constexpr mint &operator+=(mint const x) noexcept
    {
        data += x.data;
        if (data >= p)
        {
            data -= p;
        }
        return *this;
    }

    constexpr mint &operator-=(mint const x) noexcept
    {
        if (data < x.data)
        {
            data += p;
        }
        data -= x.data;
        return *this;
    }

    constexpr mint &operator*=(mint const x) noexcept
    {
        data = static_cast<u32>(static_cast<u64>(data) * x.data % p);
        return *this;
    }

    constexpr mint &operator/=(mint x)
    {
        if (x.data == 0)
        {
            throw domain_error("Division by mint zero");
        }
        u32 exp = p - 2;
        // (*this) * (x ** exp) : invariant
        while (exp > 0)
        {
            if (exp & 1)
            {
                *this *= x;
            }
            x *= x;
            exp /= 2;
        }
        return *this;
    }

    constexpr mint &operator++() noexcept
    {
        return *this += mint(1);
    }

    constexpr mint operator++(int) noexcept
    {
        mint const ret(*this);
        ++(*this);
        return ret;
    }

    constexpr mint &operator--() noexcept
    {
        return *this -= mint(1);
    }

    constexpr mint operator--(int) noexcept
    {
        mint const ret(*this);
        --(*this);
        return ret;
    }

    constexpr mint operator-() const noexcept
    {
        return mint(0) -= *this;
    }

    constexpr mint operator+(mint const x) const noexcept
    {
        return mint(*this) += x;
    }

    constexpr mint operator-(mint const x) const noexcept
    {
        return mint(*this) -= x;
    }

    constexpr mint operator*(mint const x) const noexcept
    {
        return mint(*this) *= x;
    }

    constexpr mint operator/(mint const x) const
    {
        return mint(*this) /= x;
    }

    // x >= 0 のときべき乗を計算
    constexpr mint pow(u64 const x) const noexcept
    {
        u64 exp = x;
        mint ret(1), base(*this);
        // ret * (base ** exp) : invariant, == (*this) ** x
        while (exp > 0)
        {
            if (exp & 1)
            {
                ret *= base;
            }
            base *= base;
            exp /= 2;
        }
        return ret;
    }

    constexpr mint inv() const noexcept
    {
        return mint(1) /= *this;
    }

    constexpr bool operator==(mint const x) const noexcept
    {
        return data == x.data;
    }
};

constexpr u32 mod = 1000'000'007;

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // 浮動小数の表示の精度
    cout << setprecision(15);

    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n)
    {
        int x;
        cin >> x;
        ++v[x];
    }

    bool good = true;
    if (n & 1)
    {
        good = good and (v[0] == 1);
        for (int i = 2; i < n; i += 2)
        {
            good = good and (v[i] == 2);
        }
    }
    else
    {
        for (int i = 1; i < n; i += 2)
        {
            good = good and (v[i] == 2);
        }
    }

    if (not good)
    {
        cout << "0\n";
        return 0;
    }

    int k = n / 2;
    mint<mod> ans = 2;
    ans = ans.pow(k);
    cout << ans.val() << endl;

    return 0;
}


Measured memory_bytes: 3744