import itertools

n = int(input())
d = [int(num) for num in input().split()]

d.sort(reverse=True)

result = []
for conb in itertools.combinations(d, 2):
  result.append(list(conb)) 
  
answer = 0
for i in result:
  answer += i[0]*i[1]

print(answer) import itertools itertools n = int(input()) n int(input()) int input() input int(num) for num in input().split() for num in input().split() num input().split() ().split () input split for num in input().split() int(num) int num d = [int(num) for num in input().split()] d [int(num) for num in input().split()] d.sort(reverse=True) d.sort d sort reverse=True reverse True result = [] result [] for conb in itertools.combinations(d, 2):
  result.append(list(conb)) 
   conb itertools.combinations(d, 2) itertools.combinations itertools combinations d 2 result.append(list(conb)) result.append result append list(conb) list conb answer = 0 answer 0 for i in result:
  answer += i[0]*i[1] i result answer += i[0]*i[1] answer i[0]*i[1] i[0] i 0 i[1] i 1 print(answer) print answer d = [int(num) for num in input().split()] [int(num) for num in input().split()] d answer = 0 0 answer n = int(input()) int(input()) n answer += i[0]*i[1] i[0]*i[1] answer result = [] [] result
import itertools

n = int(input())
d = [int(num) for num in input().split()]

d.sort(reverse=True)

result = []
for conb in itertools.combinations(d, 2):
  result.append(list(conb)) 
  
answer = 0
for i in result:
  answer += i[0]*i[1]

print(answer)