#include <bits/stdc++.h>
using namespace std;
int a[100005];
inline int min(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
int main() {
  int n;
  scanf("%d", &n);
  int MIN = 1 << 30;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    MIN = min(a[i], MIN);
  }
  bool flag = true;
  for (int i = 1; i <= n && flag; i++)
    if (a[i] % MIN != 0) flag = false;
  printf("%d", (flag ? MIN : -1));
  return 0;
}
