import Data.List
main = do
  getLine
  as <- map read . words <$> getLine :: IO [Int]
  print $ if check as then solve (length as `div` 2) else 0
  
check :: [Int] -> Bool
check xs
  | even $ length xs =
      all (even . length) (group $ sort xs)
  | otherwise =
      (length (filter (==0) xs) == 1) && (all (even . length) (group $ sort $ delete 0 xs))

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