import scala.io.{ StdIn => in}
import scala.annotation.tailrec

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 f(acc:Int, idx:Int, isEven:Boolean):Int = {
    val rem = if(isEven) 0 else 1
    @tailrec
    def rec(acc:Int, idx:Int):Int = {
      if(idx > n) acc
      else if(idx % 2 == rem) {
        if(arr(idx) == 2) rec(acc*2%mod, idx+1)
        else 0
      }
      else if(arr(idx) == 0) rec(acc, idx+1) else 0
    }

    rec(acc,idx)
  }

  val ans = if(arr(0) == 1) f(1,1,true)
    else if(arr(1) == 2) f(2,2,false)
    else 0

  println(ans)
}