fun main(args:Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map(String::toInt)
    val odd = A.filter { it % 2 == 0}.size
    println(Math.pow(3.0,A.size *1.0).toInt()-Math.pow(2.0,odd*1.0).toInt())    
}
