program forth
  implicit none
  integer, allocatable :: x(:), y(:)
  integer :: n, i
  integer :: tot, even, odd

  read(*,*) n
  allocate(x(n))
  allocate(y(n))

  read(*,*) x

  tot = 3 ** n ! biは3通り

  odd = 1
  do i = 1, n
     if (mod(x(i), 2) == 0) then
        odd = odd * 2
     else
        odd = odd * 1
     end if

  end do

  even = tot - odd

  write(*,*) even

  stop
end program forth


  
  
