import Control.Applicative ((<$>), (<*>), (<*), (*>), (<$))
import Control.Monad
import Data.List

main :: IO ()
main = do
  n <- getl read
  solve n <$> getl (map read . words) >>= print

solve :: Integer -> [Integer] -> Integer
solve n as
  | odd n && head sas == 0 && f 2 (tail sas) = g (n `div` 2) 1
  | even n && f 1 sas = g (n `div` 2) 1
  | otherwise = 0
  where
    mn = 1000000007
    sas = sort as
    f _ [] = True
    f s (x:y:ys) = if x == y && x == s then f (s+2) ys else False
    g m r = if m > 30 then g (m - 30) (r * ((2 ^ 30) `mod` mn) `mod` mn) else r * (2 ^ m) `mod` mn

getl :: (String -> a) -> IO a
getl f = f <$> getLine
