#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, ans = 0;
  cin >> n;
  vector<long long> vec(n);
  for (int i = 0; i < n; i++) cin >> vec[i];
  sort(vec.begin(), vec.end());
  for (int i = 0; i < n; i++) {
    if (vec[i] % vec[0] == 0) ans++;
  }
  if (ans == vec.size())
    cout << vec[0] << "\n";
  else
    puts("-1");
  return 0;
}
