{-# LANGUAGE OverloadedStrings #-}
import Data.Char
import Data.Function
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector.Unboxed as UV


readInt :: BS.ByteString -> Maybe (Int, BS.ByteString)
readInt = BS.readInt . BS.dropWhile isSpace

getIntVec :: Int -> IO (UV.Vector Int)
getIntVec n = UV.unfoldrN n readInt <$> BS.getLine

main :: IO()
main = do
  n <- readLn
  ns <- getIntVec n
  print . sum $ [((*) `on` (ns UV.!)) i j | i <- [0..n-2], j <- [i+1..n-1]]
