import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.IntMap as IM
main=print.solve.unfoldr(B.readInt.B.dropWhile isSpace)=<<B.getContents
solve=f.filter((1<).snd).IM.toDescList.IM.fromListWith(+).map(\a->(a,1)).tail
f((a,k):_)|k>=4=a*a
f((a,_):(b,_):_)=a*b
f _=0