#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, mi = 1e9 + 7, f = 0;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] < mi) mi = a[i];
  }
  for (long long i = 0; i < n; i++) {
    if (a[i] % mi) {
      f = 1;
      break;
    }
  }
  if (f == 0)
    cout << mi;
  else
    cout << -1;
  cout << '\n';
  return 0;
}
