import Data.List

main = do
  getLine
  a <- getLine >>= return . reverse . f . sort . (map read) . words
  
  print $ g $ filter (\(x,c) -> c>=2) a

  where
    f :: [Int] -> [(Int, Int)]
    f [] = []
    f xs@(x:rest) = (x, len) : (f (drop len xs))
      where
        l = takeWhile (==x) xs
        len = length l

    g ((a,_):(b,_):_) = a*b
    g (_:[]) = 0
    g [] = 0
