#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[100000];
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    int x;
    cin >> x;
    arr[i] = x;
  }
  sort(arr, arr + t);
  int y = arr[0];
  for (int i = 0; i < t; i++) {
    if (arr[i] % y != 0) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << y << endl;
  return 0;
}
