import std.stdio, std.string, std.range, std.algorithm, std.math, std.conv;

enum po = 1000_000_000 + 7;

void main() {
  auto N = readln.chomp.to!int;
  auto A = readln.split.to!(int[]);
  auto B = new int[N];
  foreach (i, a; A) {
    auto m = N - a - 1;
    if (m % 2) {
      writeln(0);
      return;
    }
    m /= 2;
    B[i] = m;
  }
  auto res = 1;
  foreach (g; sort(B).group.array) {
    if (g[1] == 1) {
      if (N % 2 == 0 || g[0] != N / 2) {
        writeln(0);
        return;
      }
    } else if (g[1] == 2) {
      res *= 2;
      res %= po;
    } else {
      writeln(0);
      return;
    }
  }
  writeln(res);
}
