fun main(arr:Array<String>) {
    val n = readLine()!!.toInt()
    val numbers = readLine()!!.split(" ").map { it.toInt() }
    if(!isSame(numbers, validList(n))) {
        println(0)
        return
    }
    var ans = 1
    for(i in (1..(n/2))) {
        ans *= 2
        ans %= 1000000000 + 7
    }
    println(ans)
}

fun isSame(num1:List<Int>, num2:List<Int>):Boolean {
    val tmp1 = num1.sorted()
    val tmp2 = num2.sorted()
    for(i in tmp1.indices) {
        if(tmp1[i] != tmp2[i]) {
            return false
        }
    }
    return true
}

fun validList(num:Int):List<Int> {
    return if(num%2==0) {
        val tmp = (1 until num step 2).map { it }.toMutableList()
        tmp.addAll(tmp)
        tmp
    } else {
        val tmp = (2 until num step 2).map { it }.toMutableList()
        tmp.addAll(tmp)
        tmp.add(0)
        tmp
    }
}