#include <bits/stdc++.h>
using namespace std;
int num[100005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &num[i]);
  }
  sort(num, num + n);
  bool ok = 1;
  for (int i = 1; i < n; ++i) {
    if (num[i] % num[0] != 0) {
      ok = 0;
      break;
    }
  }
  if (ok)
    printf("%d\n", num[0]);
  else
    printf("-1\n");
  return 0;
}
