bool TEST = false; using namespace std; #include #include #define rep(i,n) for(ll (i)=0;(i)<(ll)(n);i++) #define rrep(i,n) for(ll (i)=(ll)(n)-1;(i)>=0;i--) #define range(i,start,end,step) for(ll (i)=start;(i)<(ll)(end);(i)+=(step)) #define rrange(i,start,end,step) for(ll (i)=start;(i)>(ll)(end);(i)+=(step)) #define dump(x) cerr << "Line " << __LINE__ << ": " << #x << " = " << (x) << "\n"; #define spa << " " << #define fi first #define se second #define all(a) (a).begin(),(a).end() #define allr(a) (a).rbegin(),(a).rend() using ld = long double; using ll = long long; using ull = unsigned long long; using pii = pair; using pll = pair; using pdd = pair; template using V = vector; template using VV = V>; template using P = pair; template using M = map; template using S = set; template using UM = unordered_map; template using PQ = priority_queue, greater>; template using rPQ = priority_queue, less>; templatevector make_vec(size_t a){return vector(a);} templateauto make_vec(size_t a, Ts... ts){return vector(ts...))>(a, make_vec(ts...));} template ostream& operator << (ostream& os, const pair v){os << "(" << v.first << ", " << v.second << ")"; return os;} template ostream& operator<<(ostream &os, const vector &v) { for (auto &e : v) os << e << ' '; return os; } template ostream& operator<<(ostream& os, const vector> &v){ for(auto &e : v){os << e << "\n";} return os;} struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; template void UNIQUE(vector &x) {sort(all(x));x.erase(unique(all(x)), x.end());} template bool chmax(T &a, const T &b) { if (a bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } void fail() { cout << -1 << '\n'; exit(0); } inline int popcount(const int x) { return __builtin_popcount(x); } inline int popcount(const ll x) { return __builtin_popcountll(x); } template void debug(vector>&v){for(ll i=0;i void debug(vector&v){if(v.size()!=0)cerr< void debug(map&v){for(auto [k,v]: v) cerr << k spa v << "\n"; cerr<<"\n";} template void debug(unordered_map&v){for(auto [k,v]: v) cerr << k spa v << "\n";cerr<<"\n";} V listrange(int n) {V res(n); rep(i,n) res[i]=i; return res;} template P divmod(T a, T b) {return make_pair(a/b, a%b);} const ll INF = (1ll<<62); // const ld EPS = 1e-10; // const ld PI = acos(-1.0); void Main(){ ll n; cin >> n; V a(n); multiset s; rep(i,n) { cin >> a[i]; s.insert(a[i]); } bool f = 1; while (s.size()>1) { if (f) { auto u = s.begin(); s.erase(u); auto v = s.begin(); s.erase(v); s.insert((*u) * (*v)); } else { auto u = *s.rbegin(); s.erase(s.find(u)); auto v = *s.rbegin(); s.erase(s.find(v)); s.insert((v + u -1) / (u)); } f = !f; } ll val; for (auto v: s) { val = v; } cout << val << endl; } int main(void){ std::ifstream in("tmp_in"); if (TEST) { std::cin.rdbuf(in.rdbuf()); std::cout << std::fixed << std::setprecision(15); } else { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(15); } Main(); }