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 pow2 (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)

p = 10^9+7 :: Int

pow2 n
  | n == 0    = 1
  | odd n     = 2*r `mod` p
  | otherwise = r
  where
  q = pow2 (n `div` 2)
  r = q*q `mod` p