#include <bits/stdc++.h>
using namespace std;
int n, a[100005], gcd;
int GCD(int x, int y) {
  if (y == 0) return x;
  return GCD(y, x % y);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  gcd = a[1];
  for (int i = 2; i <= n; i++) gcd = GCD(gcd, a[i]);
  for (int i = 1; i <= n; i++) {
    if (a[i] == gcd) {
      cout << a[i];
      return 0;
    }
  }
  cout << -1;
  return 0;
}
