import qualified Data.List as List

main :: IO ()
main = do
  n <- readLn :: IO Integer
  as <- map read . words <$> getLine
  print $ solve n as


solve n as =
  if ok as
  then mod 2^(div n 2) 1000000007
  else 0
  where
    ok as =
      let
        as' = map (\s -> (head s, length s)) . List.group . List.sort $ as
      in
        case head as' of
          (0, 1) ->
            (all (\(_, x) -> x == 2) $ tail as') &&
            [0,2..n-1] == map fst as'
          (0, _) -> False
          _ ->
            (all (\(_, x) -> x == 2) $ tail as') &&
            [1,3..n] == map fst as'
