import Control.Monad
import Data.List

main = interact $ show . sol . get

get = map (map read . words) . lines

sol [[n],as] = if sort as==bs then 2^(n`div`2) else 0
  where
  bs = if odd n
    then 0:dbl [2,4..n-1]
    else dbl [1,3..n-1]

dbl = concatMap ((:) <*> return)