#include <bits/stdc++.h>
using namespace std;
int main() {
  int Total, Number, Answer;
  vector<int> Numbers;
  cin >> Total;
  for (int Z = 0; Z < Total; Z++) {
    cin >> Number;
    if (Z == 0)
      Answer = Number;
    else if (Number < Answer)
      Answer = Number;
    Numbers.push_back(Number);
  }
  for (int Z = 0; Z < Total; Z++) {
    if (Numbers[Z] % Answer != 0) {
      Answer = 0;
      break;
    }
  }
  if (Answer > 0) {
    cout << Answer << "\n";
  } else
    cout << "-1\n";
  return 0;
}
