module Main where
import Data.List

int = read::String -> Int
main = interact $ printer . solver . parser

printer = unlines . (:[]) . show
parser = map int . tail . words

solver :: [Int] -> Int
solver list = result
  where
    gr = filter (\x -> length x >= 2) . group . sortBy (flip  compare) $ list
    result = 
      if length gr >= 1 && length (gr !! 0) >= 4
      then head (gr !! 0) * head (gr !! 0)
      else if length gr >= 2 
           then head (gr !! 0) * head (gr !! 1)
           else 0
