import Control.Applicative
import Control.Monad
import qualified Data.Map as M
import Data.List
main = do
 _ <- getLine
 a_s <- (map negate . map read . words) <$> getLine
 print $ analyze a_s

analyze :: [Integer] -> Integer
analyze input = case take 2 . filter ((>1) . snd) . sort . M.toList $ M.fromListWith (+) [(c, 1) | c <- input] of
 [(x,_),(y,_)] -> x*y
 _ -> 0

