#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define for if(0);else for int solve(list& blank) { list::iterator it1, it2; while (true) { const int size = blank.size(); if (size == 0) { return -1; } if (size == 1) { return blank.front(); } it2 = it1 = blank.begin(); ++it2; int x = *it1; int y = *it2; //cout << "x=" << x << ", y=" << y << endl; if (x == y) { blank.pop_front(); continue; } if (x > y) { if(! (*it1 = *it1 % *it2)) blank.pop_front(); } else { if(! (*it2 = *it2 % *it1)) blank.erase(it2); } } } int main() { int N; cin >> N; list blank; for (int i = 0; i < N; ++i) { int x; cin >> x; blank.push_back(x); } int ret = solve(blank); if (ret < 0) { cout << "IMPOSSIBLE" << endl; } else { cout << ret << endl; } return 0; }