{-# LANGUAGE BangPatterns #-}
import Data.List
import Data.Maybe
import Data.Function (fix)
import Data.Array (Array, array, (!))
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8

modular :: Int
modular = 1000000007
 
getInts :: IO [Int]
getInts = (map parseInt . BS8.words) <$> BS.getLine 
    where parseInt = fst . fromJust . BS8.readInt

odds :: [Int]
odds = 0 : map (\x -> (x+1) - (x+1) `mod` 2) [1..]

evens :: [Int]
evens = map (\x -> x - (x+1) `mod` 2) [1..]

two :: Int -> Int
two 0 = 1
two n = ((two (n-1)) * 2) `mod` modular

solve :: [Int] -> Int
solve arr = if (n `mod` 2 == 0 && take n evens /= sorted) || (n `mod` 2 == 1 && take n odds /= sorted) then 0
            else two (n `div` 2)
    where n = length arr
          sorted = sort arr

main :: IO ()
main = do
    [n] <- getInts
    arr <- getInts
    print $ solve arr