fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val d = readLine()?.split(" ")?.map(String::toInt) ?: return
    var total = 0L
    0.until(n - 1).forEach { i ->
        i.until(n).forEach { j ->
            if (i != j) {
                total += d[i] * d[j]
            }
        }
    }
    println(total.toString())
}