void main()
{
    long n = readln.chomp.to!long;
    long[] a = readln.split.to!(long[]);

    auto g = a.sort!"a > b".group.array;
    long[2] stick;
    int cnt;
    foreach (x; g)
    {
        if (x[1] > 1)
        {
            stick[cnt] = x[0];
            ++cnt;

            if (cnt == 1 && x[1] > 3)
            {
                stick[cnt] = x[0];
                ++cnt;
            }
        }

        if (cnt > 1) break;
    }

    stick.reduce!((x, y) => x * y).writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;