#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k;
  bool solved = true;
  cin >> n;
  vector<int> a(n);
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  for (auto p : a) {
    if (p % a[0] != 0) solved = false;
  }
  if (solved)
    cout << a[0] << "\n";
  else
    cout << "-1\n";
  return 0;
}
