import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)
    d = tuple(geta(int))

    print(((sum(d)**2 - sum([di**2 for di in d]))) // 2)


if __name__ == "__main__":
    main() import sys sys from collections import defaultdict readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split()) geta return map(fn, readline().split()) map(fn, readline().split()) map fn readline().split() ().split () readline split fn=lambda s: s.decode() fn lambda s: s.decode() s.decode() s.decode s decode s def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip()) gete return fn(readline().rstrip()) fn(readline().rstrip()) fn readline().rstrip() ().rstrip () readline rstrip fn=lambda s: s.decode() fn lambda s: s.decode() s.decode() s.decode s decode s def main():
    n = gete(int)
    d = tuple(geta(int))

    print(((sum(d)**2 - sum([di**2 for di in d]))) // 2) main n = gete(int) n gete(int) gete int d = tuple(geta(int)) d tuple(geta(int)) tuple geta(int) geta int di**2 for di in d for di in d di d for di in d di**2 di 2 print(((sum(d)**2 - sum([di**2 for di in d]))) // 2) print ((sum(d)**2 - sum([di**2 for di in d]))) // 2 sum(d)**2 - sum([di**2 for di in d]) sum(d)**2 sum(d) sum d 2 sum([di**2 for di in d]) sum [di**2 for di in d] 2 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline def main():
    n = gete(int)
    d = tuple(geta(int))

    print(((sum(d)**2 - sum([di**2 for di in d]))) // 2) def main():
    n = gete(int)
    d = tuple(geta(int))

    print(((sum(d)**2 - sum([di**2 for di in d]))) // 2) main def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split()) def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split()) geta def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip()) def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip()) gete
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)
    d = tuple(geta(int))

    print(((sum(d)**2 - sum([di**2 for di in d]))) // 2)


if __name__ == "__main__":
    main()