{-# LANGUAGE BangPatterns #-}
 
module Main
  ( main
  )
where
 
import           Control.Applicative
import           Control.Monad
import           Control.Monad.ST
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.List
import           Data.Maybe
import           Data.Ord
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as MV
import qualified Data.Vector.Unboxed           as UV

parse = fst . fromJust
parseInt = parse . BS.readInt
parseInteger = parse . BS.readInteger
readInt = parseInt <$> BS.getLine
readInteger = parseInteger <$> BS.getLine
readIntList = map parseInt . BS.words <$> BS.getLine
readIntegerList = map parseInteger . BS.words <$> BS.getLine

m = 1000000000 + 7

main = do
  n <- readInt
  arr <- group . sort <$> readIntegerList
  print $ solve arr

solve (x:xs)
  | head x == 0 && length x == 1 = solve xs
  | head x /= 0 && length x == 2 = (2 * solve xs) `mod` m
  | otherwise = 0
solve _ = 1
