object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val ls = List.fill(n)(sc.nextInt).sorted(Ordering[Int].reverse)

  def recur(ls: List[Int], a: Int, b: Int): Int = ls match {
    case x :: y :: rest if x == y =>
      if (a == -1) recur(rest, x, b)
      else a * x
    case _ :: rest =>
      recur(rest, a, b)
    case _ => 0
  }
  println(recur(ls, -1, -1))
}