import Data.List

main = print . solve . take 2 . filter ((2<=) . length) . group . sortBy (flip compare) . drop 1 . map (read :: String -> Int) . words =<< getContents

solve [] = 0
solve [x]
    | length x >= 4 = head x * head x
    | otherwise = 0
solve (x:y:xs)
    | length x >= 4 = head x * head x
    | otherwise = head x * head y
