#include <bits/stdc++.h>
using namespace std;
int ff[100005];
int main() {
  int n, i;
  while (cin >> n) {
    for (i = 0; i < n; i++) cin >> ff[i];
    sort(ff, ff + n);
    for (i = 1; i < n; i++)
      if (ff[i] % ff[0] == 0)
        continue;
      else
        break;
    if (i == n)
      cout << ff[0] << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
