{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import Data.Char
import Control.Monad
import Control.Monad.ST
import Data.List

search :: VU.Vector Int -> Int -> Bool 
search vec n = runST $ do
    (vec' :: VUM.STVector s Int) <- VUM.replicate n 0
    forM_ [0..n-1] $ \i -> do
        let v = vec VU.! i
        VUM.modify vec' (+1) v 
    vec'' <- VU.unsafeFreeze vec'
    let h = VU.head vec''
    let t = VU.tail vec''
    if odd n
        then do
            return $ (h == 1) && foldl' (\b i -> let v = vec'' VU.! i in if even i then (v==2) && b else (v==0) && b) True [1..n-1]
        else do
            return $ (h == 0) && foldl' (\b i -> let v = vec'' VU.! i in if odd i then (v==2) && b else (v==0) && b) True [1..n-1]

main = do
    n <- readLn :: IO Int
    xs <- VU.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
    print $ 
        if search xs n
            then 2 ^ (n `quot` 2)
            else 0