import qualified Data.ByteString.Char8 as C
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 = if U.null u2 || U.null u4 then 0 else U.head u4
  where
  u = U.modify (sortBy (flip compare)) $ U.tail v
  u2 = U.map fst . U.filter (uncurry (==)) . U.zip u $ U.tail u
  u4 = U.map (uncurry (*)) . U.take 1 . U.filter (uncurry (/=)) . U.zip u2 $ U.tail u2