let n = stdin.ReadLine() |>  int
let d = stdin.ReadLine().Split() |> Array.map int

let d_sum = Array.sum d
let d_sq = (d |> Array.map (fun x -> pown x 2) |> Array.sum)

((pown d_sum 2) - d_sq)/2
|>stdout.WriteLine