#include <bits/stdc++.h>
using namespace std;
vector<int> in;
long long int c;
int main() {
  int a[100009], n;
  cin >> n;
  long i;
  long long int Min = 3000000000;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] < Min) Min = a[i];
  }
  int c = 0;
  for (i = 0; i < n; i++) {
    if (a[i] % Min != 0) {
      c = 1;
      break;
    }
  }
  if (c == 0)
    cout << Min << endl;
  else
    cout << "-1" << endl;
  return 0;
}
