#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, *a;
  cin >> n;
  a = new int[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int ans = -1;
  if (n == 1)
    cout << a[0];
  else {
    for (int j = 1; j < n; j++) {
      if (a[j] % a[0] == 0)
        ans = a[0];
      else {
        ans = -1;
        break;
      }
    }
    cout << ans;
  }
  delete[] a;
}
