import Data.List

main = print . solve . map read . drop 1 . words =<< getContents

solve :: [Integer] -> Integer
solve xs
    | (odd $ length xs) && head xs' /= 0 = 0
    | any (\((x,y),(x',y')) -> x /= y || x'-x /= 2 || y'-y /= 2) $ zip pairs (drop 1 pairs) = 0
    | otherwise = 2^(length xs' `div` 2) `mod` (10^9 + 7)
    where
        xs' = sort xs
        pairs = if (odd $ length xs) then tuplify (0:xs') else tuplify ((-1):(-1):xs')

tuplify (x:y:xs) = (x,y):tuplify xs
tuplify [] = []
