fun main(args: Array<String>) {
    arc066a()
}

private const val MOD = (1e9 + 7).toLong()

private fun modPow(n: Long, p: Long, m: Long): Long {
    var x = n
    var y = p
    var result = 1L

    x %= m
    while (y > 0) {
        if (y % 2 == 1L)
            result = (result * x) % m
        y = y shr 1
        x = (x * x) % m
    }

    return result
}

fun arc066a() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map { it.toInt() }.sorted()

    if (n % 2 == 0) {
        if (!aList.withIndex().all { (it.index / 2 * 2) + 1 == it.value }) return println(0)
    } else {
        if (!(aList.first() == 0 &&
                    aList.drop(1).withIndex().all { (it.index / 2 * 2) + 2 == it.value })
        ) return println(0)
    }

    val answer = modPow(2, n / 2L, MOD)

    println(answer)
}
