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