n=int(input())#输入数字的数量 a = list(map(int, input().split()))#输入一个列表 #print(a) S=0 s1=sum(a) for i in range(0,n): s1-=a[i] S+=a[i]*s1 print(S)