#include <iostream>
#include <algorithm>
using namespace std;
signed main(){
int n;
cin >> n;
int a[n];
for(int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
cout << a[0] * a[1];
}
#include <iostream>
#include <algorithm>
using namespace std;
signed main(){
int n;
cin >> n;
int a[n];
for(int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
cout << a[0] * a[1];
}