'use strict'

function Main(input) {
  const inputs = input.split('\n');
  const n = inputs[0];
  const bars = inputs[1].split(' ').sort().reverse();
  
  const sides = [];
  const vert = [];
  const hori = [];
  for (let i = 0; i < bars.length; i++) {
    if (sides.length === 2) break;
    
    const bar1 = bars[i];
    const bar2 = bars[i + 1] ? bars[i + 1] : null;
    const bar3 = bars[i + 2] ? bars[i + 2] : null;
    const bar4 = bars[i + 3] ? bars[i + 3] : null;
    if (bar1 === bar2) {
      vert.push(bar1);
    }
    if (bar3 === bar4) {
      hori.push(bar3);
    }
  }
  if (sides.length === 2) {
    console.log(vert[0] * hori[1]);
  } else {
    console.log(0);
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));