import Data.List
import Debug.Trace

main :: IO ()
main = do
  n <- readLn :: IO Int
  as <- map read . words <$> getLine :: IO [Int]
  print $ solve as

solve :: [Int] -> Int
solve as = let (x, y) = go as' in
             x * y
  where
    as' = filter ((> 1) . length) $
          group $ sortBy (flip compare) as
    go [] = (0, 0)
    go (xs:xss) = case length xs of
                    2 -> ((head xs), fst (go xss))
                    3 -> ((head xs), fst (go xss))
                    _ -> ((head xs), (head xs))
