import java.util.Scanner

import scala.math.BigInt

object Main extends App {
  val sc = new Scanner(System.in)
  val n = sc.nextInt

  val xs = Vector.fill(n)(sc.nextInt)
  val expects = Range(0, n).zipWithIndex.map { case (a, i) =>
    if (n % 2 == 0)
      if (i % 2 == 0) a + 1 else a
    else if (i % 2 == 0) a else a + 1
  }.toVector

  val ans = if (xs.sorted == expects)
    BigInt(2).modPow(BigInt(n / 2), BigInt("1000000007"))
  else 0

  println(ans)
}
