program abc143b
   implicit none

   integer :: N, i, count, j
   integer, allocatable :: d(:)

   read(*,*) N
   allocate(d(N))
   read(*,*) d(:)

   count = 0

   do i = 1, N-1
      do j = i+1, N
         count = count + d(i)*d(j)
      end do
   enddo
   write(*,*) count

end program abc143b
