#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define per(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b,a) for(int i=b;i>a;i--)
using namespace std;
#define N 100005
#define LL　long long
int n;
long long a[N];
int main(){
    scanf("%d",&n);
             memset(a,0,sizeof(a));
    per(i,0,n){
         scanf("%lld",&a[i]);
    }
     sort(a,a+n);
int flag=0;
long long chang=0,wide=0;
     rep(i,n-1,0){ 
         if(a[i]==a[i-1]&&(flag==1)&&(a[i]!=chang)){///长方形
            wide=a[i];
            break;
         }
        if(a[i]==a[i-1]&&flag==0){
            chang=a[i];
            flag=1;
            int j=i-2;///正方形
            if(a[j]==a[j-1]&&a[j]==chang){
                wide=a[j];
                break;
            }
        }
    }
     if(chang==0||wide==0)
             printf("0\n");
     else {
          long long  area=chang*wide;
          printf("%lld\n",area);
     }
return 0;
}