#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, tmp;
  long long ans1 = 0, ans2 = 0;
  map<long long, long long> cnt;
  cin >> N;
  vector<int> A(N);
  vector<int> v;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cnt[A[i]]++;
    if (cnt[A[i]] == 2) cnt[A[i]] = 0, v.push_back(A[i]);
  }
  sort(v.begin(), v.end(), greater<long long>());
  cout << 1LL * v[0] * v[1] << endl;
}
