#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> l;
  int n, maxi = 0, ind = -1;
  cin >> n;
  bool t = true, li = true;
  while (n--) {
    int x;
    cin >> x;
    if (x == 1) ind = x;
    l.push_back(x);
  }
  if (ind == 1) {
    cout << ind << endl;
    return 0;
  }
  sort(l.begin(), l.end());
  ind = 1;
  for (int i = 0; i < ((int)l.size()); i++) {
    if (l[i] % l[0] != 0) {
      ind = -1;
      break;
    }
  }
  if (ind == 1)
    cout << l[0] << endl;
  else
    cout << -1 << endl;
  return 0;
}
