#include <bits/stdc++.h>
using namespace std;
int main() {
  long ar[200000];
  long n, count;
  count = 0;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> ar[i];
  sort(ar, ar + n);
  if (ar[0] == 1)
    cout << "1" << endl;
  else {
    for (int j = 1; j < n; j++) {
      if (ar[j] % ar[0] != 0) {
        cout << "-1" << endl;
        break;
      } else
        count++;
    }
    if (count == n - 1) cout << ar[0] << endl;
  }
}
