import scala.io.StdIn._

object Main {
    def main(args: Array[String]){
        val n = readLine.toInt
        
        var x1, x2, y = 0
        readLine.split(" ").map(_.toInt).sorted.foreach { a =>
            if (x1 != a) {
                x1 = a
            } else {
                y = x2
                x2 = a
                x1 = 0
            }
        }
        
        println(x2 * y)
    }
}