import Control.Applicative
import Control.Monad
import Data.List

p = 10 ^ 9 + 7

f :: Int -> Int
f i = foldr (\x a -> (x * a) `mod` p) 1 (replicate i 2)

main :: IO ()
main = do
    n <- readLn :: IO Int
    as <- sort . fmap read . words <$> getLine :: IO [Int]

    let es = concat [replicate 2 x | x <- [1, 3 ..]]
    let os = 0 : concat [replicate 2 x | x <- [2, 4 ..]]
    let bs = if even n then take n es else take n os

    if as == bs
        then do
            case () of
                _ | length as == 1 -> print 1
                  | odd  n -> print $ f ((last as) `div` 2)
                  | even n -> print $ f ((last as + 1) `div` 2)
        else print 0