object Main {
	def main(args: Array[String]): Unit = {
		val sc = new java.util.Scanner(System.in)

    	val n: Int = sc.nextLine.toInt
    	val ax: Array[Int] = sc.nextLine.split(" ").map(_.toInt).sorted

    	var flag = true
    	for (i <- 0 until ax.length) {
    		if (ax(ax.length - (i+1)) != ax.length - (if (i%2 == 1) i else i+1) ) {
    			flag = false
    		}
    	}
    	if (flag) {
    		var c: Long = 1
    		val md: Long = math.pow(10, 9).toLong + 7
    		for (_ <- 0 until ax.length/2) {
    			c *= 2
    			if (c >= md) {
    				c -= md
    			}
    		}

    		println(c)
    	} else {
    		println(0)
    	}
	}
}