#include <bits/stdc++.h>
using namespace std;
int const N = 100 * 1000 + 16;
using ll = long long;
int n;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  vector<int> v(n);
  for (auto& x : v) cin >> x;
  int m = *min_element(v.begin(), v.end());
  if (any_of(v.begin(), v.end(), [m](int x) { return x % m; })) m = -1;
  cout << m;
}
