def main(): n = int(input()) A = list(map(int, input().split())) ans = 0 a = A[0] for b in A[1:]: ans += a*b a += b return ans print(main())