import Control.Monad
import Data.Array.Unboxed
import qualified Data.ByteString.Char8 as C
import Data.List

main = sol <$> readLn <*> get >>= print

get = unfoldr (C.readInt . C.dropWhile (==' ')) <$> C.getLine

sol n as = if check n ar then pow2 (n `div` 2) else 0
  where
  ar = accumArray (+) 0 (0,n-1) $ zip as (repeat 1) :: UArray Int Int

check n ar = if odd n
    then ar!0==1 && all ((==2) . (ar!)) [2,4..n-1]
    else all ((==2) . (ar!)) [1,3..n-1]

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