import scala.io.{ StdIn => in}

object Main extends App {
  val mod = 1000000007
  val n = in.readInt
  val arr = Array.ofDim[Int](n+1)

  in.readLine.split(" ").map(_.toInt).foreach{i => {
    arr(i) += 1
  }}

    def recEven(acc:Int, idx:Int):Int = {
      if(idx > n) acc
      else if(idx % 2 == 0) {
        if(arr(idx) == 2) recEven(acc*2%mod, idx+1)
        else 0
      }
      else if(arr(idx) == 0) recEven(acc, idx+1) else 0
    }
    def recOdd(acc:Int, idx:Int):Int = {
      if(idx > n) acc
      else if(idx % 2 == 1) {
        if(arr(idx) == 2) recOdd(acc*2%mod, idx+1)
        else 0
      }
      else if(arr(idx) == 0) recOdd(acc, idx+1) else 0
    }

  val ans = 
    if(arr(0) > 1) 0
    else if(arr(0) == 1) recEven(1,1)
    else if(arr(1) == 2) recOdd(2,2)
    else 0

  println(ans)
}