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

let rec solve x (acc, m) =
  IntMap.fold (fun a n (acc, m) ->
    if x - a < a then (acc, m)
    else if x - a = a then
      (acc + n / 2, IntMap.add a (n mod 2) m)
    else
      match IntMap.find (x - a) m with
      | exception Not_found -> (acc, m)
      | n' -> (acc + min n n', IntMap.add a (n - min n n') (IntMap.add (x - a) (n' - min n n') m))) m (acc, m)

let () = Scanf.scanf "%d\n" @@ fun n ->
  Printf.printf "%d\n" @@ fst @@
  Array.fold_right solve (Array.init 30 (( lsl ) 1))
  (0,
    Array.fold_left (fun m a -> IntMap.add a (1 + try IntMap.find a m with Not_found -> 0) m) IntMap.empty @@
    Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a)
