module Main where

import Data.List

main :: IO()
main = do
  getLine
  sticks <- map read . words <$> getLine
  print $ solve sticks

solve :: [Int] -> Int
solve = calcArea . concatMap (halfnize . flatten2r4) . filter (\g -> length g >= 2) . group . sortOn (\a -> -a)

flatten2r4 :: [Int] -> [Int]
flatten2r4 xss@(x:xs)
  | length xss == 2 = xss
  | length xss == 4 = xss
  | length xss == 3 = xs
  | length xss > 4  = flatten2r4 xs
  | otherwise       = error "おかしい"

calcArea :: [Int] -> Int
calcArea (x:y:_) = x * y
calcArea _ = 0

halfnize :: [Int] -> [Int]
halfnize ss = take (length ss `div` 2) ss
