import Control.Monad
import Data.List
import Data.Ord

solve :: [Int] -> (Int,Int) -> (Int,Int)
solve [] (a,b) = (a,b)
solve [x] (a,b) = (a,b)
solve (x:y:xs) (a,b) 
    | a * b /= 0 = (a,b)
    | x /= y = solve (y:xs) (a,b)
    | x == y && a == 0 = solve xs (x,b)
    | x == y && b == 0 = solve xs (a,x) 
    | otherwise = solve (x:xs) (a,b)

main = do
    getLine 
    xs <- sortBy (comparing Down) . map read . words <$> getLine :: IO [Int]
    let (a,b) = solve xs (0,0)
    print $ if a*b == 0 then 0 else a*b