import qualified Data.ByteString.Char8 as C
import Data.Vector.Generic ((!))
import qualified Data.Vector.Unboxed as U
import Data.Vector.Algorithms.Intro

main = C.interact $ put . sol . get

get = U.unfoldr (C.readInt . C.dropWhile (<'0'))

put = C.pack . show

sol v 
  | U.length w<2  = 0
  | w!0 /= w!1    = w!0 * w!1
  | U.length w==2 = 0
  | otherwise     = w!0 * w!2
  where
  u = U.modify (sortBy (flip compare)) $ U.tail v
  w = U.map fst . U.take 3 . U.filter (uncurry (==)) . U.zip u $ U.tail u