fs = require('fs')
l = fs.readFileSync("/dev/stdin", "utf8")
  .split("\n")[1].split(' ').map(Number).sort();
function* gen(l){
  t = null;
  while(l.length > 0){
    a = l.pop();
    if(a===t){
      yield a;
      t = null;
    }
    else{
      t = a
    }
  }
}
g = gen(l)
x = g.next(); // console.log(x)
y = g.next(); // console.log(y)
if(y["done"]){
  console.log(0)
}
else{
  console.log(x.value*y.value)
}