import Data.List

f :: Integral a => [a] -> a -> a
f [] _ = 0
f [_] _ = 0
f (x:y:xs) cur
  | x == y && cur == 0 = f xs x
  | x == y && cur /= 0 = x * cur
  | otherwise = f (y:xs) cur

main = do
  getLine
  nums <- reverse . sort . map read . words <$> getLine :: IO [Integer]
  print $ f nums 0