program bbb
implicit none

integer :: n, i, j, res
integer,allocatable,dimension(:) :: d

read*, n
allocate(d(n))
read*, d

res=0

do i=1,n
 do j=i+1,n
 res=res+d(i)*d(j)
 end do
end do

write(*,'(i0)') res

end program