import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  immutable mod = 1_000_000_000 + 7;
  auto n = readln.chomp.to!int;
  auto a = readln.chomp.split.to!(int[]);

  auto r = new int[](n/2+1);
  auto t = n % 2;

  foreach (e; a) {
    if (t == e % 2) continue;

    r[(n/2) - (e/2) - ((n+1)%2)]++;
  }

  long res = 1;
  
  foreach (i; 0..n/2 + n%2) {
    res *= r[i];
    res %= mod;
    r[i]--;
  }
  foreach_reverse (i; 0..n/2) {
    res *= r[i];
    res %= mod;
  }

  res.writeln;
}
