#!/usr/bin/env python3

n, *d = list(map(int, open(0).read().split()))

s = sum(d)

print((sum((s - i) * i for i in d)//2))

n,*d = list(map(int,open(0).read().split()))

print((sum((sum(d)-i)*i for i in d)//2))

#!/usr/bin/env python3
n, *d = list(map(int, open(0).read().split()))
s = sum(d)
print((sum((s - i) * i for i in d) // 2))

n, *d = list(map(int, open(0).read().split()))
print((sum((sum(d) - i) * i for i in d) // 2))

-#!/usr/bin/env python3 -s = sum(d) -print((sum((s - i) * i for i in d) // 2)) +print((sum((sum(d) - i) * i for i in d) // 2))