program main
    implicit none
    integer :: n, d(50), i,j,s = 0

    read(*,*)n
    read(*,*)(d(i),i = 1, n)
    
    do i = 1, n-1
      do j = i+1, n
        s = s + d(i)*d(j)
      end do
    end do
    write(*,*)s
end program main