import std.algorithm;
import std.range;
import std.math;
import std.regex;
import std.array;
import std.container;
import std.stdio;
import std.string;
import std.conv;

string[] readStrs() { return readln.chomp.split(' '); }
T[] readInts(T)() { return readln.chomp.split(' ').map!(to!T).array(); }
T readInt(T)() { return readln.chomp.to!T; }


void main()
{
    writeln(solve());
}

long solve()
{
    int N = readInt!int;
    int[] As = readInts!int;

    int[] vs = new int[N];
    foreach(i; 0 .. N)
        vs[As[i]] += 1;

    if(N % 2 == 0){
        foreach(i; 0 .. N){
            if(vs[i] != 0 && i % 2 != 1) return 0;
            if(vs[i] != 0 && vs[i] != 2) return 0;
        }

        return computeABP(2, N/2, 1_000_000_007);
    }else{
        foreach(i; 0 .. N){
            if(vs[i] != 0 && i % 2 != 0) return 0;
            if(i != 0 && vs[i] != 0 && vs[i] != 2) return 0;
            if(i == 0 && vs[i] != 1) return 0;
        }

        return computeABP(2, N/2, 1_000_000_007);
    }
}


long computeABP(int a, int b, int p)
{
    if(b == 0) return 1;
    else if(b % 2 == 0){
        long d = computeABP(a, b/2, p);
        return (d * d) % p;
    }else{
        return (a * computeABP(a, b-1, p)) % p;
    }
}
