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