def main():
    n = int(input())
    d_lst = list(map(int, input().split()))
    sum_d_lst = sum(d_lst)
    ans = 0

    for i in range(n):
        ans += d_lst[i] * (sum_d_lst - d_lst[i])

    print(ans // 2)


if __name__ == "__main__":
    main() def main():
    n = int(input())
    d_lst = list(map(int, input().split()))
    sum_d_lst = sum(d_lst)
    ans = 0

    for i in range(n):
        ans += d_lst[i] * (sum_d_lst - d_lst[i])

    print(ans // 2) main n = int(input()) n int(input()) int input() input d_lst = list(map(int, input().split())) d_lst list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split sum_d_lst = sum(d_lst) sum_d_lst sum(d_lst) sum d_lst ans = 0 ans 0 for i in range(n):
        ans += d_lst[i] * (sum_d_lst - d_lst[i])

     i range(n) range n ans += d_lst[i] * (sum_d_lst - d_lst[i]) ans d_lst[i] * (sum_d_lst - d_lst[i]) d_lst[i] d_lst i sum_d_lst - d_lst[i] sum_d_lst d_lst[i] d_lst i print(ans // 2) print ans // 2 ans 2 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    n = int(input())
    d_lst = list(map(int, input().split()))
    sum_d_lst = sum(d_lst)
    ans = 0

    for i in range(n):
        ans += d_lst[i] * (sum_d_lst - d_lst[i])

    print(ans // 2) def main():
    n = int(input())
    d_lst = list(map(int, input().split()))
    sum_d_lst = sum(d_lst)
    ans = 0

    for i in range(n):
        ans += d_lst[i] * (sum_d_lst - d_lst[i])

    print(ans // 2) main
def main():
    n = int(input())
    d_lst = list(map(int, input().split()))
    sum_d_lst = sum(d_lst)
    ans = 0

    for i in range(n):
        ans += d_lst[i] * (sum_d_lst - d_lst[i])

    print(ans // 2)


if __name__ == "__main__":
    main()
