import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as MV

main :: IO ()
main = do
    n <- fst . fromJust . B.readInt <$> B.getLine
    as <- sortBy (flip compare) . map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    mv <- V.unsafeThaw (V.fromList as)
    ans <- f mv (1 :: Int) (0 :: Int) n 1
    print ans
    where
        f mv a c n i
            | i >= n = return 0
            | otherwise = do
                x <- MV.unsafeRead mv i
                y <- MV.unsafeRead mv (i - 1)
                if x == y
                    then do
                        let b = a * x
                        MV.unsafeWrite mv i (-1)
                        if c + 1 == 2
                            then return b
                            else f mv b (c + 1) n (i + 1)
                    else f mv a c n (i + 1)
