//#define _GLIBCXX_DEBUG #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; #if __has_include() #include using namespace atcoder; using mint = modint1000000007; #endif using ll = long long; using ld = long double; using vi = vector; using vll = vector; using vvi = vector>; using vvll = vector>; const ll INF = 1ll<<60; const ld EPS = 1.0/1e9; #define endl "\n" #define rep(i,a,b) for(ll i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++) #define all(x) (x).begin(),(x).end() #define del(x) sort(all(x)); x.erase(unique(all(x)),x.end()); #define DEBUG_ template istream &operator>>(istream &is, vector &vec) { for (T &x : vec) is >> x; return is; } template ostream& operator << (ostream &os, vector& vec){ os << "{"; for(int i=0;i ostream &operator<<(ostream &os, pair &pair_var) { os << "(" << pair_var.first << ", " << pair_var.second << ")"; return os; } template ostream &operator<<(ostream &os, map &map_var) { os << "{"; repi(itr, map_var) { os << *itr; itr++; if (itr != map_var.end()) os << ", "; itr--; } os << "}"; return os; } template ostream &operator<<(ostream &os, set &set_var) { os << "{"; repi(itr, set_var) { os << *itr; itr++; if (itr != set_var.end()) os << ", "; itr--; } os << "}"; return os; } #define DUMPOUT cerr void dump_func() { DUMPOUT << endl; } template void dump_func(Head &&head, Tail &&... tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); } #ifdef DEBUG_ #define DEB #define dump(...) \ DUMPOUT << " " << string(#__VA_ARGS__) << ": " \ << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" \ << endl \ << " ", \ dump_func(__VA_ARGS__) #else #define DEB if (false) #define dump(...) #endif int main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll n; cin >> n; vll a(n); cin >> a; multisetst; rep(i,0,n) if(a[i]!=1) st.insert(a[i]); while(st.size()>1){ auto itr=st.begin(); ll x= *itr; itr=st.erase(itr); ll y= *itr; itr=st.erase(itr); st.insert(x*y); if(st.size()<=1) break; auto itr2 = st.end(); itr2--; ll p= *itr2; itr2=st.erase(itr2); itr2--; ll q= *itr2; itr2=st.erase(itr2); st.insert((p+q-1)/p); } ll ans=1; fore(c,st) ans *= c; cout << ans << endl; }