program main
 implicit none
 integer N,i,j,ans
 integer,allocatable::d(:)
 
 read(*,*) N
 allocate(d(N))
 read(*,*) d
 
 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 main