#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int n;
  cin >> n;
  vector<int> d;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    d.push_back(t);
  }
  if (n == 1) {
    cout << d[0];
  } else {
    sort(d.begin(), d.end());
    int div = d[0];
    bool isDiv = true;
    for (int i = 1; i < n; i++) {
      if (d[i] % div) {
        cout << -1;
        isDiv = false;
        break;
      }
    }
    if (isDiv) {
      cout << d[0];
    }
  }
  return 0;
}
