program ABC143B
    implicit none
    integer:: N,i,j
    integer:: result=0
    integer,allocatable,dimension(:):: D
    read *, N
    allocate(D(N))
    read*, (D(i),i=1,N)

    do i=1,N-1
        do j=i+1,N
            result=result+D(i)*D(j)
        end do
    end do

    print '(i0)',result
end program ABC143B