let m = 998244353
let ( +^ ) x y = (x + y) mod m

module IntPairMap = Map.Make (struct
  type t = int * int
  let compare = compare
end)

let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d\n" @@ fun a -> a in
  let somme = Array.fold_left ( + ) 0 as_ in
  let dp = Array.fold_left (fun dp a ->
    IntPairMap.fold (fun (r, g) n dp ->
      let dp =
        if somme <= 2 * r + 2 * a then dp
        else IntPairMap.add (r + a, g) (n +^
          try IntPairMap.find (r + a, g) dp with Not_found -> 0) dp in
      let dp =
        if somme <= 2 * g + 2 * a then dp
        else IntPairMap.add (r, g + a) (n +^
          try IntPairMap.find (r, g + a) dp with Not_found -> 0) dp in dp) dp dp) (IntPairMap.singleton (0, 0) 1) as_ in
  Printf.printf "%d\n" @@ IntPairMap.fold (fun (r, g) n acc ->
    if 2 * r + 2 * g > somme then n +^ acc else acc) dp 0
