def main():
    import sys
    readline = sys.stdin.buffer.readline

    n = int(readline())
    d = list(map(int, readline().split()))

    e = sum(d)
    ans = 0
    for i in d:
        e -= i
        ans += i*e
    print(ans)

if __name__ == '__main__':
    main() def main():
    import sys
    readline = sys.stdin.buffer.readline

    n = int(readline())
    d = list(map(int, readline().split()))

    e = sum(d)
    ans = 0
    for i in d:
        e -= i
        ans += i*e
    print(ans) main import sys sys readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline n = int(readline()) n int(readline()) int readline() readline d = list(map(int, readline().split())) d list(map(int, readline().split())) list map(int, readline().split()) map int readline().split() ().split () readline split e = sum(d) e sum(d) sum d ans = 0 ans 0 for i in d:
        e -= i
        ans += i*e
     i d e -= i e i ans += i*e ans i*e i e print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    import sys
    readline = sys.stdin.buffer.readline

    n = int(readline())
    d = list(map(int, readline().split()))

    e = sum(d)
    ans = 0
    for i in d:
        e -= i
        ans += i*e
    print(ans) def main():
    import sys
    readline = sys.stdin.buffer.readline

    n = int(readline())
    d = list(map(int, readline().split()))

    e = sum(d)
    ans = 0
    for i in d:
        e -= i
        ans += i*e
    print(ans) main
def main():
    import sys
    readline = sys.stdin.buffer.readline

    n = int(readline())
    d = list(map(int, readline().split()))

    e = sum(d)
    ans = 0
    for i in d:
        e -= i
        ans += i*e
    print(ans)

if __name__ == '__main__':
    main()