#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, a[100000];
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  i = n - 1;
  sort(a, a + n);
  while ((i >= 0) && (a[i] % a[0] == 0)) i--;
  if (i == -1)
    cout << a[0];
  else
    cout << -1;
  return 0;
}
