import qualified Data.ByteString.Char8 as B
import           Data.Char
import qualified Data.IntMap.Strict    as M
import           Data.List

main :: IO ()
main = do
    n <- readLn
    as <- M.fromListWith (+) . (flip zip) (repeat 1) <$> readInts
    print $ solve n as

readInts :: IO [Int]
readInts = unfoldr (B.readInt . B.dropWhile isSpace) <$> B.getLine

solve :: Int -> M.IntMap Int -> Int
solve n as 
    | all (== 2) peri
        = powWithMod (10 ^ 9 + 7) 2 (M.size peri)
    | otherwise
        = 0
    where peri = peripheries as

peripheries :: M.IntMap Int -> M.IntMap Int
peripheries mp = if odd (M.size mp) then M.delete 0 mp else mp

powWithMod :: Int -> Int -> Int -> Int
powWithMod m n 0 = 1
powWithMod m n p = n %*% powWithMod m n (p - 1)
    where x %*% y = x * y `mod` m