#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> arr(n);
  long long min_el = INT64_MAX;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    min_el = min(arr[i], min_el);
  }
  bool ok = true;
  for (long long i = 0; i < n; i++) {
    if (arr[i] % min_el != 0) ok = false;
  }
  if (ok)
    cout << min_el;
  else
    cout << "-1";
  return 0;
}
