

def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    D = read_ints()
    S = sum(D)
    answer = 0
    for d in D:
        S -= d
        answer += d*S
    return answer


if __name__ == '__main__':
    print(solve()) def read_int():
    return int(input().strip()) read_int return int(input().strip()) int(input().strip()) int input().strip() ().strip () input strip def read_ints():
    return list(map(int, input().strip().split(' '))) read_ints return list(map(int, input().strip().split(' '))) list(map(int, input().strip().split(' '))) list map(int, input().strip().split(' ')) map int input().strip().split(' ') ().strip().split ().strip() ().strip () input strip split ' ' def solve():
    N = read_int()
    D = read_ints()
    S = sum(D)
    answer = 0
    for d in D:
        S -= d
        answer += d*S
    return answer solve N = read_int() N read_int() read_int D = read_ints() D read_ints() read_ints S = sum(D) S sum(D) sum D answer = 0 answer 0 for d in D:
        S -= d
        answer += d*S
     d D S -= d S d answer += d*S answer d*S d S return answer answer if __name__ == '__main__':
    print(solve()) __name__ == '__main__' __name__ '__main__' print(solve()) print solve() solve def read_ints():
    return list(map(int, input().strip().split(' '))) def read_ints():
    return list(map(int, input().strip().split(' '))) read_ints def read_int():
    return int(input().strip()) def read_int():
    return int(input().strip()) read_int def solve():
    N = read_int()
    D = read_ints()
    S = sum(D)
    answer = 0
    for d in D:
        S -= d
        answer += d*S
    return answer def solve():
    N = read_int()
    D = read_ints()
    S = sum(D)
    answer = 0
    for d in D:
        S -= d
        answer += d*S
    return answer solve


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    D = read_ints()
    S = sum(D)
    answer = 0
    for d in D:
        S -= d
        answer += d*S
    return answer


if __name__ == '__main__':
    print(solve())
