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