let rec power ( * ) one m = function
  | 0 -> one
  | n when n mod 2 = 0 ->
      power ( * ) one (m * m) (n / 2)
  | n ->
      m * power ( * ) one m (n - 1)

let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let as_ = Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a)) in
  Array.sort compare as_;
  if
    n mod 2 = 0 && as_ = Array.init n (fun i -> (i + 1) - i mod 2) ||
    n mod 2 = 1 && as_ = Array.init n (fun i -> (i + 1) - (i + 1) mod 2)
  then Printf.printf "%d\n" @@ power (fun n m -> n * m mod 1000000007) 1 2 (n / 2)
  else print_endline "0"