#include using namespace std; #include using Int = boost::multiprecision::cpp_int; int main() { int n; cin>>n; vector a(n); for (auto& x : a) { cin>>x; } multiset ms(a.begin(), a.end()); for (int i = 0; i < n-1; ++i) { assert(ms.size() >= 2); if (i & 1) { // Bob's turn auto x1 = *prev(ms.end()); ms.erase(prev(ms.end())); auto x2 = *prev(ms.end()); ms.erase(prev(ms.end())); ms.insert((x2 + x1 - 1)/x1); } else { // Alice's turn auto xl = *ms.begin(); ms.erase(ms.begin()); if (xl > 1) { auto xr = *ms.begin(); ms.erase(ms.begin()); ms.insert(xl*xr); } else { auto xr = *prev(ms.end()); ms.erase(prev(ms.end())); ms.insert(xl*xr); } } } assert(ms.size() == 1); cout << *ms.begin() << endl; }