import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import Data.List

main = do
  getLine
  input <- filter ((> 1) . length) . group . sort <$> getIntListBC
  if length input <= 1 then print 0
                       else let a = head . last $ input
                                b = head . last . init $ input
                            in print $ a * b

bsToInt :: BC.ByteString -> Int
bsToInt = fst . fromJust . BC.readInt

getIntListBC :: IO [Int]
getIntListBC = map bsToInt . BC.words <$> BC.getLine