//Bai 20
#include<bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long
#define ull unsigned long long
#define se second
#define fi first
#define be begin()
#define en end()
#define Faster cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int n;
void Run()
{
cin >> n;
vector<ll> vt1, vt2, vt3;
ll ans = 1;
while(n--)
{
ll x; cin >> x;
if(x > 0) vt1.push_back(x);
else if(x < 0) vt2.push_back(x);
else vt3.push_back(x);
}
if(vt1.size() == 0 && vt2.size() == 0)
{
cout << 0;
}
else
{
if(vt1.size())
{
sort(vt1.begin(), vt1.end());
for(auto x : vt1) ans *= x;
}
if(vt2.size())
{
sort(vt2.begin(), vt2.end(),greater<ll>());
if(vt2.size() % 2)
{
for(int i = 1 ; i < vt2.size(); i++) ans*= vt2[i];
}
else
{
for(auto x : vt2) ans *= x;
}
}
}
if(vt1.size() == 0 && vt2.size() == 1) ans = vt2[0];
if(ans < 0 && vt3.size()) ans = 0;
cout << ans;
}
int main()
{
Faster;
Run();
return 0;
}
Ly9CYWkgMjAKCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgZWwgIlxuIgojZGVmaW5lIGxsIGxvbmcgbG9uZwojZGVmaW5lIHVsbCB1bnNpZ25lZCBsb25nIGxvbmcKI2RlZmluZSBzZSBzZWNvbmQKI2RlZmluZSBmaSBmaXJzdAojZGVmaW5lIGJlIGJlZ2luKCkKI2RlZmluZSBlbiBlbmQoKQojZGVmaW5lIEZhc3RlciBjaW4udGllKDApOyBjb3V0LnRpZSgwKTsgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTsKaW50IG47CnZvaWQgUnVuKCkKewogICAgY2luID4+IG47CiAgICB2ZWN0b3I8bGw+IHZ0MSwgdnQyLCB2dDM7CiAgICBsbCBhbnMgPSAxOwogICAgd2hpbGUobi0tKQogICAgewogICAgICAgIGxsIHg7IGNpbiA+PiB4OwogICAgICAgIGlmKHggPiAwKSB2dDEucHVzaF9iYWNrKHgpOwogICAgICAgIGVsc2UgaWYoeCA8IDApIHZ0Mi5wdXNoX2JhY2soeCk7CiAgICAgICAgZWxzZSB2dDMucHVzaF9iYWNrKHgpOwogICAgfQogICAgaWYodnQxLnNpemUoKSA9PSAwICYmIHZ0Mi5zaXplKCkgPT0gMCkKICAgIHsKICAgICAgICBjb3V0IDw8IDA7CiAgICB9CiAgICBlbHNlCiAgICB7CiAgICAgICAgaWYodnQxLnNpemUoKSkKICAgICAgICB7CiAgICAgICAgICAgIHNvcnQodnQxLmJlZ2luKCksIHZ0MS5lbmQoKSk7CiAgICAgICAgICAgIGZvcihhdXRvIHggOiB2dDEpIGFucyAqPSB4OwogICAgICAgIH0KICAgICAgICBpZih2dDIuc2l6ZSgpKQogICAgICAgIHsKICAgICAgICAgICAgc29ydCh2dDIuYmVnaW4oKSwgdnQyLmVuZCgpLGdyZWF0ZXI8bGw+KCkpOwogICAgICAgICAgICBpZih2dDIuc2l6ZSgpICUgMikKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZm9yKGludCBpID0gMSA7IGkgPCB2dDIuc2l6ZSgpOyBpKyspIGFucyo9IHZ0MltpXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGZvcihhdXRvIHggOiB2dDIpIGFucyAqPSB4OwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgaWYodnQxLnNpemUoKSA9PSAwICYmIHZ0Mi5zaXplKCkgPT0gMSkgYW5zID0gdnQyWzBdOwogICAgaWYoYW5zIDwgMCAmJiB2dDMuc2l6ZSgpKSBhbnMgPSAwOwogICAgY291dCA8PCBhbnM7Cn0KaW50IG1haW4oKQp7CiAgICBGYXN0ZXI7CiAgICBSdW4oKTsKICAgIHJldHVybiAwOwp9Cgo=