#include <bits/stdc++.h>
using namespace std;
int main() {
  int list[100002];
  int flag = 0;
  int count;
  int min = -1;
  cin >> count;
  for (int i = 0; i < count; i++) {
    cin >> list[i];
    if (min == -1 || list[i] < min) min = list[i];
  }
  for (int i = 0; i < count; i++) {
    if (list[i] % min != 0) {
      flag = 1;
      break;
    }
  }
  if (flag) {
    cout << "-1" << endl;
  } else {
    cout << min << endl;
  }
  return 0;
}
