val MOD = 1000000007L

fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toInt() }
    val abs = mutableMapOf<Int, Int>()

    aa.forEach {
        abs[it] = (abs[it] ?: 0)+1
    }

    var prev = -1

    abs.entries.sortedBy { it.key }.forEach {
        if (prev == -1) {
            if (n % 2 == 0 && (it.key != 1 || it.value != 2)) {
                println(0)
                return
            }
            if (n % 2 == 1 && (it.key != 0 || it.value != 1)) {
                println(0)
                return
            }
            prev = it.key
            return@forEach
        }

        if (it.key - prev != 2 || it.value != 2) {
            println(0)
            return
        }

        prev = it.key
    }

    var ans = 1L
    repeat(n/2) {
        ans *= 2
        ans %= MOD
    }

    println(ans)
}