import Data.List
import qualified Data.ByteString.Char8 as B

main = getLine >> breads >>= print . solve

solve :: [Int] -> Int
solve = check . filter (\x -> length x > 1) . group . sortBy (flip compare)
    where
        check (x : y : _)
            | length x > 3 = head x * head x
            | otherwise = head x * head y
        check (x : _)
            | length x > 3 = head x * head x
            | otherwise = 0
        check _ = 0
        
breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)
