#include<bits/stdc++.h>

using namespace std;

priority_queue<long long> pq;
long long ans[100005];

int main()
{
    int n;
    scanf("%d",&n);
    int i;
    for(i=0;i<n;i++)
    {
        long long t1;
        scanf("%lld",&t1);
        pq.push(t1);
    }
    long long before;
    before = 0;
    int c = 0;
    while(!pq.empty())
    {
        long long now = pq.top(); pq.pop();
        if(now == before)
        {
            before = 0;
            ans[c++] = now;
        }
        else before = now;
    }
    long long ans1 = ans[0]*ans[1];
    printf("%lld",ans1);
}
