#include <bits/stdc++.h>
using namespace std;
long long arr[100001];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  int ret = -1;
  long long min = arr[0];
  for (int i = 1; i < n; i++) {
    if (min > arr[i]) min = arr[i];
  }
  bool check = 1;
  for (int i = 0; i < n; i++)
    if (arr[i] % min != 0) {
      check = 0;
      break;
    }
  if (check)
    cout << min << endl;
  else
    cout << ret << endl;
}
