#!/bin/bash

typeset -i SUM=0
typeset -i SKIP=1
typeset -i SKIPC=1
typeset -i V1=0
typeset -i V2=0
read N
read VARS

for V1 in $(echo $VARS)
do
        #echo $V1
        SKIPC=$SKIP
        for V2 in $(echo $VARS)
        do
                #echo $V2
                if [[ $SKIPC -gt 0 ]] ; then
                        SKIPC=$SKIPC-1
                        continue
                fi
                SUM=$((SUM+V1*V2))
        done
        SKIP=$SKIP+1
done

echo $SUM
