import Control.Applicative
import Data.List

searchedge1 []=(0,[])
searchedge1 [x]=(0,[])
searchedge1 (x:y:xs)
    |x==y = (x,xs)
    |otherwise = searchedge1 (y:xs)

searchedge2 []=0
searchedge2 [x]=0
searchedge2 (x:y:xs)
    |x==y = x
    |otherwise = searchedge2 (y:xs)

solver xs =(\(x,y)->(x*y)) $(\(y,ys)->(y,searchedge2 ys))$ searchedge1 xs
 
main :: IO ()
main = do
    getLine
    xs <- map read . words <$> getLine
    putStrLn $ show $ solver $ reverse (sort  xs)