#import <stdio.h>
#import <stdlib.h>

long compare_int(const void *a, const void *b) {
    return *(long*)b - *(long*)a;
}

int main(int argc, const char * argv[]) {
    int N;
    scanf("%d", &N);
    long *A = (long*)malloc(N * sizeof(long));
    
    long n;
    long i = 0;
    while (scanf("%ld", &n) != EOF) {
        A[i] = n;
        i++;
    }
    
    qsort(A, N, sizeof(long), compare_int);
    
    long first = 0;
    long second = 0;
    for(i=0;i<N;i++) {
        if (i<N-1 && A[i]==A[i+1]) {
            if (first == 0) {
                first = A[i];
                i++;
            } else {
                second = A[i];
                break;
            }
        }
    }
    
    printf("%ld", first*second);
    
    free(A);
    return 0;
}

