solver::[Int]->Int
solver xs = let n = length xs in
            3^n - 2^(length (filter (\x -> (mod x 2) == 0 ) xs))

main::IO()
main=do
  _<-getLine
  d<-getLine
  let dat = map read (words d)
  print (solver dat)
