let () = Scanf.scanf "%d\n" @@ fun n ->
  let ls = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun l -> l in
  let acc = Array.make 2002 0 in
  Array.iter (fun l -> acc.(l) <- 1 + acc.(l)) ls;
  for i = 0 to 2000 do
    acc.(i + 1) <- acc.(i) + acc.(i + 1)
  done;
  Printf.printf "%d\n" @@
  (fun s -> s / 6) @@
  Array.fold_left (Array.fold_left ( + )) 0 @@
  Array.init n @@ fun i ->
    Array.init n @@ fun j ->
      if i = j then 0 else
      (* |a - b| < c < a + b *)
      acc.(ls.(i) + ls.(j) - 1) - acc.(abs (ls.(i) - ls.(j)))
      - (if abs (ls.(i) - ls.(j)) < ls.(i) then 1 else 0)
      - (if abs (ls.(i) - ls.(j)) < ls.(j) then 1 else 0)