#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, min = 1000000000, t = 0;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    if (min > v[i]) min = v[i];
  }
  for (int i = 0; i < n; ++i) {
    if (v[i] % min != 0) t = 1;
  }
  if (t == 1)
    cout << "-1" << endl;
  else
    cout << min << endl;
  return 0;
}
