#include <bits/stdc++.h>
using namespace std;
long long n, m, a[111111];
int main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (long long i = 1; i <= n; i++)
    if (a[i] % a[1] == 0) m++;
  if (m == n)
    cout << a[1];
  else
    cout << -1;
}
