#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (!b) return a;
  return (gcd(b, a % b));
}
int main() {
  int i, n, ans = -1, cal;
  bool flag = false;
  scanf("%d", &n);
  vector<int> v(n);
  for (i = 0; i < n; i++) {
    scanf("%d", &(v[i]));
  }
  cal = v[0];
  for (i = 1; i < n; i++) {
    cal = gcd(cal, v[i]);
    if (cal == 1) break;
  }
  for (i = 0; i < n; i++) {
    if (cal == v[i]) {
      flag = true;
      break;
    }
  }
  if (flag) {
    ans = cal;
  }
  printf("%d", ans);
  return 0;
}
