! 2019.10.19
!
      program answer
      implicit none
      integer :: N
      integer,allocatable,dimension(:) :: d
      integer :: i,j
      integer :: ans
!
      read(*,*) N
      allocate(d(N))
      read(*,*) (d(i),i=1,N)
!
      ans = 0
!
      do i=1,N-1
        do j=i+1,N
          ans = ans + d(i) * d(j)
        end do
      end do
!
      write(*,*) ans
      end program answer
