import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "a", long, "b");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    auto a = aryread();
    if (a.lineup())
        power_mod(2, n / 2).writeln();
    else
        writeln(0);
}

bool lineup(T)(T ary)
{
    long[long] dic;
    foreach (e; ary)
    {
        if (e in dic)
            dic[e]++;
        else
            dic[e] = 1;
    }
    bool ret = true;
    foreach (i; iota((ary.length % 2 ? 0 : 1), ary.length, 2))
    {
        ret &= (i in dic && dic[i] == (i == 0 ? 1 : 2));
    }
    return ret;
}

// 累積二乗法
long power_mod(long a, long n, long mod = MOD)
{
    long ret = 1;
    while (n)
    {
        if (n % 2)
        {
            ret *= a;
            ret %= mod;
        }
        a^^=2;
        a %= mod;
        n >>= 1;
    }
    return ret % mod;
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}
