import Data.List
import qualified Data.ByteString.Char8 as BS
main = do
  BS.getLine
  as <- map (read . BS.unpack) . BS.words <$> BS.getLine :: IO [Int]
  print $ if check as then solve (length as `div` 2) else 0
  
check :: [Int] -> Bool
check [] = True
check as@(x:_)
  | even $ length as =
    (even $ length $ filter (==x) as) && (check $ filter (/=x) as) 
  | otherwise =
    if (length (filter (==0) as) == 1) then (check $ delete 0 as) else False

solve :: Int -> Int
solve 1 = 2 `mod` (10^9+7)
solve n = (2 * solve (n-1)) `mod` (10^9+7)