#include<bits/stdc++.h>

// @author : sam000013

#define int long long

#define PI 3.14159265
#define pb(x) push_back(x)
#define all(v) v.begin(), v.end()
#define endl cout<<"\n" 
#define dbg(x) cout<<#x<<" "<<x;endl;
#define bye endl;return
#define uni 1.000000
using namespace std;

const int mod = 1000000007;
template<typename T>

void debug(vector<T> x){
for(auto e:x){
    cout<<e<<" ";
}
cout<<"\n";
}
/*


*/

void solve(){
    int n;
    cin>>n;
    if(n){
        cout<<0;bye;
    }
    cout<<1;bye;
    vector<int> v(n);
    vector<int> pos, neg;
    int zero = 0;
    for(int i=0;i<n; i++){
        cin>>v[i];
        if(v[i] > 0){
            pos.push_back(v[i]);
        }else if(v[i] == 0){
            zero++;
        }else{
            neg.push_back(v[i]);
        }
    }
    sort(all(pos));
    sort(all(neg));
    // debug(pos);debug(neg);
    if(pos.size() == (int)0){
        if(zero == (int)0){
            int product = 1;
            for(int i = neg.size()-1, j = 0;j<5; i--,j++){
                product *= neg[i];
            }
            cout<<product;bye;
        }else{
            cout<<0;bye;
        }
    }else{
        
        if(neg.size() + pos.size() < 5){
            cout<<0;bye;
        }
        
        if(pos.size() >= 5){
            int done = 0;
            vector<int> ans(3);
            ans[0] = 1;
            for(int i=pos.size()-1; i>=0; i--){
                ans[0] *= pos[i];
                done++;
                if(done == (int) 5)
                    break;
            }
            done = 0;
            ans[1] = 1;
            for(int i=pos.size()-1,j=0; i>=0 && j<3; i--, j++){
                ans[1] *= pos[i];
                done++;   
            }
            // dbg(ans[1]);
            if(neg.size() >= 2){
                ans[1] = ans[1] * (neg[0] * neg[1]);
            }
            // dbg(ans[1]);
            done = 0;
            ans[2] = pos[pos.size()-1];
            if(neg.size() >= 4){
                ans[2] *= (neg[0] * neg[1] * neg[2] * neg[3]);
            }
            int mxm = -1;
            // debug(ans);
            for(int i=0; i<3; i++)
                mxm = max(mxm, ans[i]);
            cout<<mxm;bye;
        
        }else if(pos.size() >= 3){
            int done = 0;
            vector<int> ans(2);
            ans[0] = 1;
            for(int i=pos.size()-1; i>=0; i--){
                ans[0] *= pos[i];
                done++;
                if(done == (int) 3)
                    break;
            }
            if(neg.size() >= 2){
                ans[0] *= (neg[0] * neg[1]);
            }

            done = 0;
            ans[1] = pos[pos.size()-1];
            if(neg.size() >= 4){
                ans[1] *= (neg[0] * neg[1] * neg[2] * neg[3]);
            }
            int mxm = -1;
            // debug(ans);
            for(int i=0; i<2; i++)
                mxm = max(mxm, ans[i]);
            cout<<mxm;bye;
        }else{
            int ans = pos[pos.size()-1];
            if(neg.size() >= 4){
                ans *= (neg[0] * neg[1] * neg[2] * neg[3]);
                cout<<ans;bye;
            }else if(zero > 0){
                cout<<0;bye;
            }else{
                int i=0, j=neg.size()-1;
                int done = 0;
                ans = 1;
                while(i<pos.size() && j>=0){
                    if(done==5)
                        break;
                    if(abs(neg[i]) >= pos[i]){
                        ans *= pos[i];
                        done++;
                        i++;
                    }else{
                        ans *= neg[j];
                        j--;
                    }
                }
                while(i<pos.size()){
                    if(done==5)
                        break;
                    ans *= pos[i];
                    done++;
                    i++;
                }
                while(j>= 0){
                    if(done==5)
                        break;
                    ans *= neg[j];
                    done++;
                    j--;
                }
                cout<<ans;bye;
                
            }


        }
        
        
        
    }



}


signed main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;
    //cin>>t;
    for(int i=1; i<=t; i++){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3636