import Data.List
main = do
  getLine
  xs <- map read . words <$> getLine
solve3 xs = case filter ((2 <=) . length) . group $ sortBy (flip compare) xs of
  ((x : _ : _ : _ : _) : _) -> x * x
  ((x : _ : _) : (y : _ : _) : _) -> x *y
  _ -> 0
