#include using namespace std; typedef long long ll; #define rep(i,n) for(ll i=0; i<(ll)n; i++) #define reps(i,n) for(ll i=1; i<=(ll)n; i++) #define repi(i,a,b) for(ll i=(ll)a; i<(ll)b; i++) #define pb push_back #define mp make_pair #define ALL(i) i.begin(),i.end() ll INF = 1000000000000000; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll n; cin >> n; ll a; multiset st; rep(i,n) { cin >> a; st.insert(a); } ll now=0; while(st.size()!=1){ ll v=*prev(st.end()); ll w=*prev(prev(st.end())); st.erase(st.find(v)); st.erase(st.find(w)); if(now%2) { if(w%v) st.insert(w/v+1); else st.insert(w/v); } else st.insert(v*w); now++; } cout << *st.begin() << endl; }