from itertools import combinations

n = int(input())
d = list(map(int, input().split()))
ans = 0
sum = sum(d)
for i in d:
    sum -= i
    ans += i*sum
print(ans) from itertools import combinations n = int(input()) n int(input()) int input() input d = list(map(int, input().split())) d list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = 0 ans 0 sum = sum(d) sum sum(d) sum d for i in d:
    sum -= i
    ans += i*sum i d sum -= i sum i ans += i*sum ans i*sum i sum print(ans) print ans ans += i*sum i*sum ans sum -= i i sum ans = 0 0 ans sum = sum(d) sum(d) sum n = int(input()) int(input()) n d = list(map(int, input().split())) list(map(int, input().split())) d
from itertools import combinations

n = int(input())
d = list(map(int, input().split()))
ans = 0
sum = sum(d)
for i in d:
    sum -= i
    ans += i*sum
print(ans)