import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

void main() {
    readln;
    auto xs = readints();

    int[int] m;
    long[] cans;
    foreach (x; xs) {
        int t = ++m[x];
        if (t == 2 || t == 4)
            cans ~= x;
    }

    if (cans.length >= 2) {
        partialSort!"a > b"(cans, 2);
        writeln(cans[0] * cans[1]);
    }
    else {
        writeln(0);
    }
}
