#include <iostream>
#include <vector>

template <typename Integer = unsigned long long, Integer Mod = 1000000007>
class ModInt
{
public:
    ModInt(Integer value = {}) : _value(value) {}

    ModInt(const ModInt &from) = default;

    operator Integer() const { return _value; }

    friend ModInt pow(ModInt lhs, Integer rhs)
    {
        ModInt result = 1;
        while(rhs)
        {
            if(rhs & 1)
            {
                result *= lhs;
            }
            lhs *= lhs;
            rhs >>= 1;
        }
        return result;
    }

    ModInt &operator+=(const ModInt &rhs)
    {
        _value += rhs._value;
        _value %= Mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &rhs)
    {
        _value += Mod;
        _value -= rhs._value;
        _value %= Mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &rhs)
    {
        _value *= rhs._value;
        _value %= Mod;
        return *this;
    }
    ModInt &operator/=(const ModInt &rhs)
    {
        *this *= pow(rhs, Mod - 2);
        return *this;
    }

    friend ModInt operator+(ModInt lhs, const ModInt &rhs)
    {
        lhs += rhs;
        return lhs;
    }
    template <typename T>
    friend ModInt operator+(const ModInt &lhs, const T &rhs)
    {
        return lhs + ModInt(rhs);
    }
    template <typename T>
    friend ModInt operator+(const T &lhs, const ModInt &rhs)
    {
        return ModInt(lhs) + rhs;
    }
    friend ModInt operator-(ModInt lhs, const ModInt &rhs)
    {
        lhs -= rhs;
        return lhs;
    }
    template <typename T>
    friend ModInt operator-(const ModInt &lhs, const T &rhs)
    {
        return lhs - ModInt(rhs);
    }
    template <typename T>
    friend ModInt operator-(const T &lhs, const ModInt &rhs)
    {
        return ModInt(lhs) - rhs;
    }
    friend ModInt operator*(ModInt lhs, const ModInt &rhs)
    {
        lhs *= rhs;
        return lhs;
    }
    template <typename T>
    friend ModInt operator*(const ModInt &lhs, const T &rhs)
    {
        return lhs * ModInt(rhs);
    }
    template <typename T>
    friend ModInt operator*(const T &lhs, const ModInt &rhs)
    {
        return ModInt(lhs) * rhs;
    }
    friend ModInt operator/(ModInt lhs, const ModInt &rhs)
    {
        lhs /= rhs;
        return lhs;
    }
    template <typename T>
    friend ModInt operator/(const ModInt &lhs, const T &rhs)
    {
        return lhs / ModInt(rhs);
    }
    template <typename T>
    friend ModInt operator/(const T &lhs, const ModInt &rhs)
    {
        return ModInt(lhs) / rhs;
    }

private:
    Integer _value;
};

template <typename Integer>
Integer permutation(Integer lhs, const Integer &rhs)
{
    Integer result = 1;
    for(Integer i = 0; i != rhs; i += 1)
    {
        result *= lhs;
        lhs -= 1;
    }
    return result;
}
template <typename Integer>
Integer combination(const Integer &lhs, const Integer &rhs)
{
    return permutation(lhs, rhs) / permutation(rhs, rhs);
}

int main()
{
    unsigned int n;
    std::cin >> n;
    std::vector<unsigned int> validate((n + 1) / 2);
    bool valid = true;
    unsigned int buf;
    while(std::cin >> buf)
    {
        ++validate[buf / 2];
    }
    for(unsigned int i = 0; i != validate.size(); ++i)
    {
        if((i == 0 && n % 2))
        {
            if(validate[i] != 1)
                valid = false;
        }
        else if(validate[i] != 2)
        {
            valid = false;
        }
    }
    std::cout << (valid ? static_cast<int>(pow(ModInt<>(2), n / 2)) : 0)
              << std::endl;
}

Measured memory_bytes: 384