import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main=do
    n<-readLn :: IO Int
    as <-sort.unfoldr (B.readInt.B.dropWhile(==' '))<$>B.getLine :: IO [Int]
    print $ if even n then chke as else chko as

chke = chk 1 1
chko (a:as)
    | a /= 0 = 0
    | True   = chk 1 2 as
                
chk p _ [] = p
chk p n (a:b:as)
    | a==n && b==n = chk ((p*2)`mod`1000000007) (n+2) as
    | True = 0
