#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  vector<int> v;
  cin >> n;
  {
    for (int i = 0; i < int(n); i++) {
      int x;
      cin >> x;
      v.push_back(x);
    }
  };
  int small = 2000000000;
  for (int i = 0; i < int(n); i++) {
    {
      if (v[i] < small) small = v[i];
    };
  }
  for (int i = 0; i < int(n); i++) {
    if (v[i] % small != 0) {
      cout << "-1" << endl;
      return 0;
    }
  }
  cout << small << endl;
  return 0;
}
