import java.io.{BufferedReader, InputStreamReader}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val n = in.readLine().toInt
    val ds = in.readLine().split("\\s+").map(_.toInt)

    val sum = ds.sum

    System.out.println(
      ds.map { d =>
        (sum - d) * d
      }.sum / 2
    )
  }
}
