import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val N = sc.nextInt
  val A = (0 until N).map(_ => sc.nextInt)
  val dup = A.groupBy(identity).toSeq.flatMap(t => (Seq.fill(t._2.size / 2)(t._1))).sorted(Ordering[Int].reverse)
  println((dup ++ Seq(0, 0)).take(2).reduce(_ * _))
}