import io.StdIn.readLine


object Main {

  def isEven(i: Int): Boolean = i % 2 == 0

  def res(k: Int): Int = {
    val r = 1000000000 + 7
    ((1 to k).foldLeft(1) { (acc, _) => (acc * 2) % r }) % r
  }

  def main(args: Array[String]): Unit = {
    var n = readLine().toInt
    var a = readLine().split(' ').map(_.toInt).groupBy(i => i)

    if (n % 2 == 0) {
      val x = a.keys.toArray
      val y = (1 to (n / 2)).map(_ * 2 - 1)
      if (x.exists(isEven) || x.diff(y).length > 0 || y.diff(x).length > 0 || a.values.map(_.length).exists(_ != 2))
        println(0)
      else
        println(res(n / 2))
    } else {
      val x = a.keys.toArray
      val y = (0 to (n - 1) / 2).map(_ * 2)
      if (x.exists(!isEven(_)) || x.diff(y).length > 0 || y.diff(x).length > 0 || (a - 0).values.map(_.length).exists(_ != 2))
        println(0)
      else
        a.get(0) match {
          case Some(Array(0)) => println(res((n - 1) / 2))
          case None => println(0)
        }
    }
  }

}
