import Data.List
import Data.Bool

main = print . bool' (const 0) (product . take 2 . map head) ((2<=) . length) . filter ((2<=) . length) . group . sortBy (flip compare) . drop 1 . map (read :: String -> Int) . words =<< getContents

bool' f t b x = bool (f x) (t x) (b x)
