import Control.Applicative( (<$>))
import Data.ByteString.Char8( readInt, getLine, words	)
import qualified Data.ByteString.Char8 as C8
import Data.Maybe( fromJust)
import Data.List( sortBy)

main = do
    let
	readBS2Int = fst . fromJust . readInt
	readLine2Ints = map readBS2Int . C8.words <$> C8.getLine

    n_ <- readLn::IO Int
    as_ <- readLine2Ints
    let
	desc = sortBy (flip compare) as_

	collect::Int->Int->[Int]->Integer
	collect 0 0 []	= 0
	collect 0 0 [a]	= 0
	collect 0 0 (a1:tl@(a2:as))
	  | a1==a2	    = collect a1 0 as
	  | otherwise	    = collect 0 0 tl
	collect l 0 [] = 0
	collect l 0 [a] = 0
	collect l 0 (a1:tl@(a2:as))
	  | a1==a2	    = fromIntegral l* fromIntegral a2
	  | otherwise	    = collect l 0 tl
    
    print $ collect 0 0 desc