#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int usc(int x, int y) {
  while (y != 0) {
    int tg = y;
    y = x % y;
    x = tg;
  }
  return x;
}
void process() {
  int n, kq;
  cin >> n;
  scanf("%d", &a[0]);
  kq = a[0];
  for (int i = 1; i < n; i++) {
    scanf("%d", &a[i]);
    kq = usc(kq, a[i]);
  }
  int k = 0;
  for (int i = 0; i < n; i++)
    if (kq % a[i] == 0) {
      k = 1;
      cout << a[i];
      break;
    }
  if (k == 0) cout << -1;
}
int main() {
  process();
  return 0;
}
