import itertools n=int(input()) number=list(map(int,input().split())) goukei=0 combination=list(itertools.combinations(number,2)) for i in combination: for j in i: goukei+=j print(goukei)