OIG XIV - des

// tresc: https://szkopul.edu.pl/problemset/problem/4a-jxx9cKl1DHr7zcPdSugqQ/site/?key=statement
// OIG XIV (1 etap)

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

    int liczba_desek;
    cin >> liczba_desek;

    if (liczba_desek < 4) {
        cout << 0;
        return 0;
    }

    vector<long long> v(liczba_desek);

    for (int i = 0; i < v.size(); i++) {
        cin >> v[i];
    }

    sort(v.begin(), v.end(), greater<long long>());

    cout << v[3] * v[3];

    return 0;
}