from collections import Counter N = int(input()) A = list(map(int, input().split())) C = Counter(A) ans = 0 for a, n in C.items(): for b, m in C.items(): ans += n * m * pow(a, b) print(ans)