#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  int ans = *min_element(a, a + n);
  bool ok = true;
  for (int i = 0; i < n; ++i) {
    if (a[i] % ans != 0) {
      ok = false;
      break;
    }
  }
  if (ok)
    cout << ans << endl;
  else
    cout << "-1" << endl;
  return 0;
}
