#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
int n,a[10005],sum=1,k=0;
int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a+1,a+1+n);
    for(int i=n; i>=2;)
    {
        if(a[i]==a[i-1])
        {
            sum*=a[i];
            i-=2;
            k++;
            printf("%d***\n",k);
            if(k==2) break;
        }
        else
            i--;
    }
    if(k<2) printf("0\n");
    else  printf("%d\n",sum);
    return 0;
}