Problem:
 Score : 200 points    Problem Statement It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The deliciousness of the i -th takoyaki is d_i .  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.      Constraints  All values in input are integers.  2 \leq N \leq 50  0 \leq d_i \leq 100         Input Input is given from Standard Input in the following format:  N  d_1  d_2  ...  d_N       Output Print the sum of the health points restored from eating two takoyaki over all possible choices of two takoyaki from the N takoyaki served.        Sample Input 1 3
3 1 2      Sample Output 1 11  There are three possible choices:   Eat the first and second takoyaki. You will restore 3 health points.  Eat the second and third takoyaki. You will restore 2 health points.  Eat the first and third takoyaki. You will restore 6 health points.   The sum of these values is 11 .       Sample Input 2 7
5 0 7 8 3 3 2      Sample Output 2 312

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
sum = 0
for i in range(N):
    for j in range(i, N):
        if i != j:
            sum += d[i] * d[j]
print(sum)

Solution (Python):
if __name__ == '__main__':
    N = int(input())
    d = [int(i) for i in input().split()]
    ret = 0
    for i, v in enumerate(d):
        for j in d[i + 1:]:
            ret += v * j
    print(ret)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))

ans = 0
for i in range(n-1):
    for j in range(i+1,n):
   
        ans += d[i]*d[j]

print(ans)

Solution (Python):
n = int(input())
li = list(map(int,input().split()))

sum_up = 0
for i in range(len(li)):
    for j in range(i+1, len(li)):
        sum_up += li[i] * li[j]
print(sum_up)

Solution (Python):
import sys
import itertools

input = sys.stdin.readline


def main():
    n = int(input())
    d_list = map(int, input().split())
    hoge = 0
    for a, b in itertools.combinations(d_list, 2):
        hoge += a * b
    print(hoge)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())

D = list(map(int, input().split()))

ans = 0

for i in range(N):
	for j in range(N):

		if i >= j:
			continue
		else:
			ans += D[i] * D[j]

print(ans)

Solution (Python):
def main():
    N = int(input())
    d = list(map(int, input().split()))

    tmp = 0
    for i in range(N):
        for j in range((i+1),N):
            tmp += d[i] * d[j]
    
    print(tmp)

if __name__ == '__main__':
    main()

Solution (Python):
k=0
n=int(input())
p=[int(i) for i in input().split()]
for i in range(n):
    for j in range(i+1,n):
        k+=p[i]*p[j]
print(k)

Solution (Python):
n = int(raw_input())
takos = list(map(int, raw_input().split(" ")))

ans = 0
for i in range(n):
	for j in range(i+1, n):
		ans += takos[i]*takos[j]
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
su=0
for i  in range(n):
	for j  in range(i+1, n):
		su += a[i]*a[j]
print(su)

Solution (Python):
N = int(input())
ds = list(map(int, input().split()))
ans = 0
for i in range(N):
    for j in range(N):
        if i != j:
            ans += ds[i] * ds[j]
print(str(ans // 2))

Solution (Python):
import itertools

N = int(input())

lst = (map(int, input().split()))

l = list(itertools.combinations(lst,2))

ans = 0
for i in l:
  ans += i[0]*i[1]
print(ans)

Solution (Python):
N = int(input())
d_list = [int(i) for i in input().split(" ")]
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        ans += d_list[i] * d_list[j]

print(ans)

Solution (Python):
N=int(input())
d=list(map(int, input().split()))
ans = 0
for i in range(N):
  for j in range(i+1,N):
    ans += d[i] * d[j]
print(ans)

Solution (Python):
n = int(input())
num =list(map(int,input().split()))

aa = 0

for i in range(n):
    for j in range(i+1,n):
        aa += num[i]*num[j]
print(aa)

Solution (Python):
N=int(input())
d=list(map(int,input().split()))

ans=0
for i in range(N-1):
    for j in range(1+i,N):
        if i!=j:
            ans+=d[i]*d[j]
print(ans)

Solution (Python):
N=int(input())
D=list(map(int, input().split()))
ans=[]
for i in range(N-1):
    for j in range(i+1,N):
        ans.append(D[i]*D[j])
print(sum(ans))

Solution (Python):
import itertools

n = int(input())
d = list(map(int, input().split()))

combs = itertools.combinations(d, 2)
sum = 0
for a, b in combs:
    sum += a * b
print(sum)

Solution (Python):
from itertools import combinations

N = int(input().strip())
ds = list(map(int, input().strip().split()))


print(sum([a * b for a, b in combinations(ds, 2)]))

Solution (Python):
N = int(input())

D = input().split()

total = 0
for i in range(N):
	for j in range(N):
		if not i == j:
			total += int(D[i]) * int(D[j])
			
			
print(int(total/2))

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
d_sum = 0
for i in range(n):
    for j in range(i+1,n):
        d_sum += d[i]*d[j]
print(d_sum)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
ans = 0
for i in range(n):
  for j in range(i+1,n):
    ans += d[i]*d[j]
print(ans)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
count = 0
for i in range(n-1):
    for j in range(n-i-1):
        count += d[i]*d[j+i+1]
print(count)

Solution (Python):
n = int(input())
d = [int(i) for i in input().split()]
total = 0

for i in range(n):
    for j in range(i+1, n):
        total += d[i]*d[j]
        
print(total)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
total=0
for i in range(n-1):
  for j in range(i+1,n):
    total+=d[i]*d[j]
print(total)

Solution (Python):
N = int(input())
d_list = list(map(int,input().split()))
ans = 0
for i in range(N):
  for j in range(i+1,N,1):
    ans += d_list[i] *d_list[j]
print(ans)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

sum = 0
for i in range(N):
    for j in range(i+1, N):
        sum += d[i] * d[j]
print(sum)

Solution (Python):
n = int(input())
d = [int(i) for i in input().split()]
s = 0
for i in range(n-1):
  for j in range(i+1, n):
    s += d[i]*d[j]
print(s)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
  for j in range(i+1,N):
    ans += A[i]*A[j]

print(ans)

Solution (Python):



import sys


input = sys.stdin.readline


def main():
    N = int(input())
    d = [int(i) for i in input().split()]

    ans = 0
    for i in range(N):
        for j in range(i):
            ans += d[i]*d[j]

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
ans=0
for i in range(n):
    for j in range(i+1,n):
        ans+=d[i]*d[j]
print(ans)

Solution (Python):
N = int(input())
dl = list(map(int, input().split()))

ans = 0
for i, d1 in enumerate(dl):
  for j, d2 in enumerate(dl):
    if i == j:
      continue
    ans += (d1 * d2)
print(int(ans / 2))

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
cnt = 0

for i in range(n - 1):
    for j in range(i + 1,n):
        cnt += d[i] * d[j]
print(cnt)

Solution (Python):
import sys
input = sys.stdin.readline
n = int(input())
d = list(map(int,input().split()))
d_sum = sum(d)
ans = 0
for i in range(n):
  d_sum -= d[i]
  ans += d[i]*d_sum
print(ans)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
x = 0
y = 0
for i in range(n):
    x += d[i]
    y += d[i] ** 2
a = (x ** 2 - y) / 2
print(int(a))

Solution (Python):
import itertools
N=int(input())
d_list=[int(i) for i in input().split()]
comb = list(itertools.combinations(d_list, 2))
sum_heal = 0
for i,j in comb:
    sum_heal += i*j
print(sum_heal)

Solution (Python):
if __name__ == '__main__':
    N = int(input())
    d = [int(i) for i in input().split()]
    ret = 0
    for i, v in enumerate(d):
        for j in d[i + 1:]:
            ret += v * j
    print(ret)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    ans += d[i]*sum(d[i+1:])
print(ans)

Solution (Python):
N = int(input())
d = [int(x) for x in input().split()]

sum_ = 0
for i in range(N-1):
    for j in range(i+1, N):
        sum_ += d[i]*d[j]
print(sum_)

Solution (Python):
N=int(input())
d=[int(i) for i in input().split()]
a=0
for j in range (N-1):
    for k in range(j+1,N):
        A=d[j]*d[k]
        a=a+A
print(a)

Solution (Python):
n = int(input())
d = list( map(int, input().split())) 

ans = 0
sumd = sum(d)

for i in range(n):
    ans += d[i]*sum(d[i+1:])

print(ans)

Solution (Python):
from itertools import combinations
input()
d = [int(x) for x in input().split()]
print(sum(x * y for x, y in combinations(d, 2)))

Solution (Python):
N = int(input())


D = list(map(int, input().split()))

cnt = 0
import itertools
l = list(itertools.combinations(D,2))
for t in l:
    cnt += t[0] * t[1]
print(cnt)

Solution (Python):
def main():
    N = int(input())
    d_list = [int(i) for i in input().split()]
    sum = 0

    for i, x in enumerate(d_list):
        for y in d_list[i + 1:]:
            sum += x * y
    print(sum)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

res = 0
for i in range(N):
    res += sum(D[i + 1:])*D[i]
print(res)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))

d2_sum = 0
for i in range(n) :
    d2_sum += d[i]**2

print((sum(d)**2-d2_sum)//2)

Solution (Python):
n=int(input())
d=[int(i) for i in input().split()]
ans=chk=0
for i in range(n):
    for j in range(n):
        if i!=j:
            ans+=d[i]*d[j]
print(ans//2)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
ans = 0
for i in range(n):
  for j in range(i+1,n):
    ans += d[i] * d[j]

print(ans)

Solution (Python):
n = int(input())
d = list(map(int, input().split(" ")))

ans = 0
for i in range(n):
    for j in range(i+1, n):
        ans += d[i]*d[j]

print(ans)

Solution (Python):
from itertools import combinations

n = int(input())
d = list(map(int, input().split()))
c = list(combinations(d, 2))

ans = 0
for e in c:
    ans += e[0]*e[1]

print(ans)

Solution (Python):
N = int(input())
D = list(map(int,input().split()))
ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += D[i]*D[j]
print(ans)

Solution (Python):
n = int(input())
D = list(map(int, input().split()))

from itertools import combinations

ans = 0
for x1, x2 in combinations(D, 2):
    ans += x1*x2

print(ans)

Solution (Python):
n = int(input())
tako = list(map(int, input().split()))

total = 0

for i in range(n-1):
    for j in range(i+1, n):
        total += tako[i]*tako[j]

print(total)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))

ans=0

for i in range(n):
    for j in range(i+1,n):
            ans+=a[i]*a[j]
print(ans)

Solution (Python):
import itertools
N = input()
D = list(map(int, input().split()))
sum = 0
for i in itertools.combinations(D, 2):
    sum += i[0] * i[1]
print(sum)

Solution (Python):
import sys
input = sys.stdin.readline

n = int(input())
d = list(map(int, input().split()))

value = 0
for i in range(n):
  d1 = d[i]
  for j in d[i+1:]:
    d2 = j
    value += d1 * d2
    
print(value)

Solution (Python):
n = int(input())
d = [int(x) for x in input().split()]

sum = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        sum += d[i] * d[j]

print(sum)

Solution (Python):
n = int(input())
d = [int(i) for i in input().split()]

a = 0
for i in range(n):
    for j in range(i+1,n):
        a += d[i]*d[j]
print(a)

Solution (Python):
n = int(input())
l = [int(_) for _ in input().split()]
ans = 0
for i in range(0, n-1):
    for j in range(i+1, n):
        ans += l[i]*l[j]
print(ans)

Solution (Python):
import itertools

def main():
    _ = input()
    d = [int(x) for x in input().split()]
    ans = 0
    for a, b in itertools.combinations(d, 2):
        ans += a * b
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
ans = 0
d = list(map(int,input().split()))
k = 1
for i in range(n):
    for j in range(k,n):
        ans += d[i]*d[j]
    k += 1
    
print(ans)

Solution (Python):
def resolve():
    N = int(input())
    d = list(map(int,input().split()))
    ans = 0
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            else:
                ans += d[i] * d[j]
    print(ans // 2)
resolve()

Solution (Python):
if __name__ == "__main__":
    N = int(input())
    d = list(map(int, input().split()))

    ans = 0
    for i in range(N):
        for j in range(N):
            if i != j:
                ans += d[i]*d[j]
    
    print(ans//2)

Solution (Python):
import numpy as np

N=int(input())

d=np.array(input().split(),dtype=np.int32)

s=0

for i in range(N):
    for j in range(i+1,N):
        s+=d[i]*d[j]

print(s)

Solution (Python):

n = int(input())
d = list(map(int, input().split()))
result=0
for i in range(n):
    for j in range(i+1, n):
        result += d[i] * d[j]
print(result)

Solution (Python):
N = int(input())
arr = [int(i) for i in input().split()]
ans = 0
for i in range(N-1):
    for j in range(1, N-i):
        ans += arr[i] * arr[i+j]
print(ans)

Solution (Python):
N = int(input())
l_d = list(map(int,input().split()))
a = 0
for i in range(N):
    for j in range(i+1,N):
        a += l_d[i]*l_d[j]
print(a)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
sum = 0
for i in range(N-1):
    for j in range(i+1, N):
        sum += d[i] * d[j]
print(sum)

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

count = 0
for i in range(N):
  for j in range(i + 1, N):
    count += D[i] * D[j]
    
print(count)

Solution (Python):
n = int(input())

sum1 = 0
li = list(map(int,input().split()))
for i in range(n):
    for j in range(n):
        if i != j:
            sum1 += li[i]*li[j]
print(sum1//2)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

ans = 0
for i in range(n-1):
  for j in range(i+1,n):
    cure = d[i] * d[j]
    ans += cure
print(ans)

Solution (Python):
n = int(input())
d =        list( map(int, input().split()) )	

ans=0

for i in range(n-1):
	for j in range(i+1,n):
		ans += d[i]*d[j]

print(ans)

Solution (Python):

"""

A, B = map(int, input().split())

ans = A - 2 * B

if ans >= 0:
    print(ans)
else:
    print(0)
"""


import sys
n = int(input())
d = list(map(int, sys.stdin.readline().strip().split()))

ans = 0

for i in range(n - 1):
    for j in range(i + 1, n):
        ans += d[i] * d[j]

print(ans)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
v = 0
for i in range(N):
    for j in range(N):
        if i<j:
            v += d[i]*d[j]
print(v)

Solution (Python):
a=[]
b=int(input())
for x in input().split(" "):
    a.append(int(x))

i=0
j=1
t=0

while i<b:
    while j<b:
        t+=a[i]*a[j]
        j+=1
    i+=1
    j=i+1
print(t)

Solution (Python):
import itertools
N = int(input())
d = list(map(int, input().split()))
sum = 0
for i in itertools.combinations(d, 2):
    sum += i[0] * i[1]
print(sum)

Solution (Python):
N = int(input())
d = list(map(int,input().split()))
ans = 0
for i in range(N):
    for j in range(N):
        if i < j:
            ans += d[i] * d[j]
print(ans)

Solution (Python):
N = int(input())
ds = list(map(int, input().split()))


ans = 0

for i in range(N-1): 
    for j in range(i+1,N): 
        
        ans += ds[i] * ds[j]

print(ans)

Solution (Python):
import itertools
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N = int(input())
        d = list(map(int, input().split()))

        ans = 0
        for comb in itertools.combinations(d, 2):
            ans += comb[0] * comb[1]

        print(ans)



if __name__ == '__main__':
    AtCoder().main()

Solution (Python):
N = int(input())
d = input()
d = list(map(int,d.split()))
s = 0
for i in range(N):
    for j in range(i+1,N):
        s += d[i]*d[j]
print(s)

Solution (Python):
N = int(input())
d = [int(i) for i in input().split()]

X = 0

for i in range(N):
  for j in range(i+1,N):
    X += d[i]*d[j]

print(X)

Solution (Python):
n = int(input())
ar = list(map(int, input().split()))
total = 0
for i in range(n):
    for j in range(i + 1, n):
        total += (ar[i] * ar[j])
print(total)

Solution (Python):
def main():
    n = int(input())
    d = list(map(int, input().split()))
    
    ans = 0

    for i in range(n - 1):
      for j in range(i + 1, n):
        ans += d[i] * d[j]

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
dList = [int(i) for i in input().split()]
dsum = sum(dList)

sum = 0
for i in range(N):
    sum += dList[i] * (dsum-dList[i])

sum /= 2
print(int(sum))

Solution (Python):
n = int(input())

d = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    for j in range(i+1,n):
       ans += d[i]*d[j]
print(ans)

Solution (Python):
n=int(input())
s=0
a=[int(i) for i in input().split()]
for i in range(n):
  for j in range(i+1,n):
    s+=a[i]*a[j]
print(s)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

ans = 0

for i in range(N):
    for j in range(i+1,N):
        ans += d[i]*d[j]

print(ans)

Solution (Python):

N=int(input())
d=list(map(int,input().split()))
ans=0
for i in range(N):
    for j in range(i+1,N):
        ans=ans+d[i]*d[j]
print(ans)

Solution (Python):






import math
import statistics
import numpy as np
import queue

n = int(input())
d = list(int(i) for i in input().split())

ans = 0
for l in range(n):
  for r in range(l + 1, n):
    if l == r:
      continue
    else:
      ans += (d[l] * d[r])

print(ans)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
allSum = sum(d)
total = 0
for i in range(len(d)):
    allSum-=d[i]
    total+=d[i]*allSum
print(total)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

sum = 0
import itertools
for com in itertools.combinations(range(n), r=2):
  x = d[com[0]]
  y = d[com[1]]
  sum += x * y

print(sum)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
n=int(input())
dd=map(int,input().split())
from itertools import combinations
print(sum(a*b for a,b in combinations(dd,2)))

Solution (Python):

import sys
args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False
input = sys.stdin.readline
N = int(input())
Ds = list(map(int, input().split()))
if em: sys.stdin = open('/dev/tty')
sum = 0
for i in range(len(Ds)):
  for j in range(i + 1, len(Ds)):
    sum += Ds[i] * Ds[j]
print(sum)

Solution (Python):
n=int(input())
lists=list(map(int,input().split()))
count=0
for i in range(n):
    for j in range(i+1,n):
        count+=lists[i]*lists[j]
print(count)

Solution (Python):
n = int(input())
xs = list(map(int, input().split(" ")))

out = 0
for i in range(n-1):
    x = xs[i]
    nokori = sum(xs[i+1:])
    out += (x * nokori)
print(out)

Solution (Python):
n=int(input())
D=list(map(int,input().split()))
a=0
for i,d in enumerate(D):
  for j,e in enumerate(D):
    if i!=j:
    	a+=d*e
print(a//2)

Solution (Python):
N = int(input())
d_list = list(map(int,input().split()))
ans = 0
for i in range(len(d_list)-1):
    for j in range(i+1,len(d_list)):
        ans += d_list[i] * d_list[j]
print(ans)

Solution (Python):
N = int(input())
ds = list(map(int, input().split()))

res = 0
for i in range(N):
    di = ds[i]
    for j in range(i+1, N):
        res += di * ds[j]
print(res)

Solution (Python):
N = int(input())
d = list(map(int,input().split()))
sum_d = sum(d)
rest = sum_d
res = 0
for i in range(len(d)):
  rest -= d[i]
  res += d[i] * rest
print(res)

Solution (Python):
n = int(input())
d = [int(x) for x in input().split()]
ans = 0
for i in range(n):
    for j in range(i+1,n):
        ans += d[i] * d[j]
print(ans)

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
s = 0
for i in range(n):
  for j in range(i+1,n):
    s += A[i]*A[j]
print(s)

Solution (Python):
n = int(input())
arr = [int(x) for x in input().split()]

res = 0
for i in range(n):
	for j in range(i+1,n):
		res += arr[i]*arr[j]

print(res)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
B=sum(A)
count=0
for i in range(N):
    count+=A[i]**2
print((B**2-count)//2)

Solution (Python):


n = int(input())
d = input()
d_list = d.split(" ")
d_int_list = []

for item in d_list:
    d_int_list.append(int(item))

ret = 0
for i in range(len(d_int_list)):
    for j in range(i+1, len(d_int_list)):
        ret += d_int_list[i] * d_int_list[j]

print(ret)

Solution (Python):
n = int(input())
oisisa = list(map(int, input().split()))
ans = 0
for i in range(n):
    for j in range(i+1, n):
        cur = oisisa[i]*oisisa[j]
        ans += cur
print(ans)

Solution (Python):
N = int(input())
D = [int(e) for e in input().split()]

num = 0
for i in range(N):
    for j in range(i+1,N):
        num += D[i] * D[j]

print(num)

Solution (Python):
N=int(input())
d=list(map(int,input().split()))
HP=0
for i in range(N):
    for j in range(i+1,N):
        HP+=d[i]*d[j]
print(HP)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

total = 0
for i in range(N-1):
    for j in range(i+1, N):
        total += d[i] * d[j]

print(total)

Solution (Python):
N = int(input())
d = [int(i) for i in input().split()]

sum_d = 0
for i in range(N-1):
    for j in range(i+1, N):
        sum_d += d[i]*d[j]


print(sum_d)

Solution (Python):
n=int(input())
d=[int(i) for i in input().split()]

c=0
for i in range(n-1):
    for j in range(i+1,n):
        c+=d[i]*d[j]

print(c)

Solution (Python):
N = int(input())

d = list(map(int,input().split()))

s = 0

for i in range(N):
    for j in range(i+1, N):
        s+=d[i]*d[j]
print(s)

Solution (Python):
def f(D):
    n = len(D)
    sum_ = 0
    for first in range(n):
        for second in range(first + 1, n):
            deliciousness = D[first] * D[second]
            sum_ += deliciousness
    return sum_

assert f([3, 1, 2]) == 11
assert f([5, 0, 7, 8, 3, 3, 2]) == 312

N = int(input())
D = list(map(int, input().split()))
ans = f(D)
print(ans)

Solution (Python):
N = int(input())
d = [int(i) for i in input().split()]

ans = 0

for i in range(N-1):
    for j in range(i+1, N):
        ans += d[i]*d[j]

print(ans)

Solution (Python):
import itertools
n = int(input())
D = [int(i) for i in input().split()]

ans = 0
for d in itertools.combinations(D,2):
    ans += d[0]*d[1]
print(ans)

Solution (Python):
n = map(int, input())
d_list = list(map(int, input().split()))

sum = 0
for i in range(len(d_list)):
    for j in range(len(d_list)):
        if i == j:
            continue
        elif i > j:
            continue
        else:
            sum += d_list[i] * d_list[j]
            
print(sum)

Solution (Python):
import sys
input = sys.stdin.readline


n = int(input())
d = list(map(int,input().split()))

ans = 0
for i in range(n):
    for j in range(i,n):
        if i==j: continue
        ans += d[i] * d[j]

print(ans)

Solution (Python):
n = int(input())
d = [int(x) for x in input().split()]

ans = []
for idx1 in range(n):
    for idx2 in range(n):
        if idx1 < idx2:
            ans.append(d[idx1]*d[idx2])
print(sum(ans))

Solution (Python):
n = int(input())
l = list(map(int, input().split()))

c = 0
for i in range(n-1):
    for j in range(i+1, n):
        c += l[i]*l[j]
                
print(c)

Solution (Python):
N = int(input())
d = [int(x) for x in input().split()]
count = 0

for i in range(N):
    for j in range(i+1,N):
        count += d[i] * d[j]
print(count)

Solution (Python):
n = input()
l = map(int, raw_input().split())

s = 0
for i in range(n):
	for j in range(i + 1, n):
		s += l[i] * l[j]

print s

Solution (Python):
N=int(input())
d=list(map(int,input().split()))

ans=0
for i in range(N):
    for j in range(i+1,N):
        ans+=d[i]*d[j]

print(ans)

Solution (Python):
N = int(input())
takos = list(map(int, input().split()))

sum_delicious = 0

for i in range(N):
	x = takos[i]
	for j in range(i + 1, N):
		y = takos[j]
		sum_delicious += x * y

print(sum_delicious)

Solution (Python):
from itertools import combinations
N = int(input())
d = map(int, input().split())
ans = 0
for c in combinations(d, 2):
    ans += c[0]*c[1]
print(ans)

Solution (Python):
from itertools import combinations

n = int(input())
D = [int(_) for _ in input().split()]
ans = 0
for a,b in combinations(D,2):
    ans +=a*b
print(ans)

Solution (Python):
import itertools
N = int(input())
D = list(map(int, input().split()))
lst = list(itertools.combinations(D, 2))
total = 0
for i in lst:
    total += i[0]*i[1]

print(total)

Solution (Python):

"""
Created on Sat Apr 20 20:47:47 2019

@author: Owner
"""

import numpy as np
import sys
import collections
import scipy.misc
import math
from operator import itemgetter
import itertools
import copy
import bisect
import heapq


def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   

def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]
    


N = int(input())
D = list(map(int, input().split()))

    
def main(): 
    res = 0
    for n in range(N-1):
        for m in range(n+1, N):
            res += D[n]*D[m]
    return print(res)
                
                
            
            
                

    
if __name__ == '__main__':
    main()



"""
N, X = map(int, input().split())

x = list(map(int, input().split()))

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())


all(nstr.count(c) for c in '753')


ABT = zip(A, B, totAB)

A, B, totAB = zip(*ABT)


(x >> i) & 1


dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break

add = 1 
res = 0
sums = [0]*(len(nums)+1)
for i in range(len(nums)):
    sums[i+1] = sums[i] + nums[i]
for i in range(0, len(nums), 2):
    left = i
    right = min(i+add, len(nums))
    tmp = sums[right] - sums[left]
    res = max(tmp, res)


li, ri = bisect.bisect_left(p_ac, l[i]-1), bisect.bisect_right(p_ac, r[i]-1)    


org_list = [3, 1, 4, 5, 2]
new_list = sorted(org_list)
print(org_list)
print(new_list)




    for h in range(0,H):
        for w in range(0,W):
            if h == 0 and w == 0:
                pass
            elif h == 0:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h-1][W-w]+1)
            elif w == 0:   
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1)
            else:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1, D[H-h-1][W-w]+1, D[H-h][W-w]+2)
            d_max = max(D[H-h-1][W-w-1], d_max)

"""

Solution (Python):
n = int(input())
d = tuple(map(int, input().split()))

count = 0
for i in range(0, n-1):
  for j in range(i+1, n):
    count += d[i] * d[j]
print(count)

Solution (Python):
from itertools import combinations

N = int(input())
takoyaki = map(int, input().split(" "))

score = 0
for x, y in combinations(takoyaki, 2):
    score += x * y
print(score)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
dd = [x * y for x in d for y in d]
xx = [x * x for x in d]
print((sum(dd) - sum(xx)) // 2)

Solution (Python):
n = int(input())
d = [int(i) for i in input().split()]
a = 0
b = 0

for i in range(n):
    a=a+d[i]

for i in range(n):
    b= b+d[i]*(a-d[i])

print(b//2)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
sqsum = sum(i*i for i in a)
ans = (sum(a)*sum(a) - sqsum) //2
print(ans)

Solution (Python):
N = int(input())
takoyaki = list(map(int,input().split()))


score = 0
for i in range(N-1):
    for j in range(i+1,N):
        score += takoyaki[i] * takoyaki[j]

print(score)

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

from itertools import combinations
li2 = list(combinations(li,2))

point = 0
for i in range(len(li2)):
    point += (li2[i][0] * li2[i][1])

print(point)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(n):
    for j in range(i+1,n):
        ans+=l[i]*l[j]
print(ans)

Solution (Python):

import sys
import itertools

def solve(N: int, d: "List[int]"):
    dd = list(itertools.combinations(d,2)) 
    answer = 0
    for ddd in dd:
        answer += ddd[0]*ddd[1]
    print(answer)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    d = [int(next(tokens)) for _ in range(N)]  
    solve(N, d)

if __name__ == '__main__':
    main()

Solution (Python):
'''
import sys
input=sys.stdin.readline
n,m,c = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
from math import ceil
from collections import defaultdict ,Counter
'''
n = int(input())
a = list(map(int,input().split()))
su=0
for i in range(n):
    for j in range(i+1,n):
        su+=a[i]*a[j]
print(su)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
ans=0
for i in range(n-1):
  for j in range(i+1,n):
    ans+=d[i]*d[j]
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

N = int(input())
d = [int(i) for i in input().split()]
total = 0
for i in range(N):
    for j in range(i+1, N):
        total += d[i]*d[j]

print(total)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
sum=0
for i in range(n-1):
  for j in range(i+1,n):
    sum+=d[i]*d[j]
print(sum)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        ans += d[i] * d[j]
print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))

sum=0
for i in range(n):
  for j in range(i+1,n):
    sum += a[i]*a[j]
    
print(sum)