#include <bits/stdc++.h>
using namespace std;
void FastIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
long long modpow(long long a, long long p, long long mod) {
  long long ret = 1;
  while (p) {
    if (p & 1) ret = (ret * a) % mod;
    a = (a * a) % mod;
    p /= 2;
  }
  return ret;
}
long long power(long long a, long long p) {
  long long ret = 1;
  while (p) {
    if (p & 1) ret = (ret * a);
    a = (a * a);
    p /= 2;
  }
  return ret;
}
int p[1000011];
vector<int> prms;
void sieve(int n) {
  int i, j;
  prms.push_back(2);
  for (int i = 3; i < n; i++) {
    if (!(i % 2) || p[i]) continue;
    prms.push_back(i);
    for (j = 2 * i; j < n; j += i) p[j] = 1;
  }
}
int a[1011];
bool b[1000011];
int main() {
  FastIO();
  sieve(100000);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[a[i]] = 1;
  }
  sort(a, a + n);
  if (a[0] == 1) {
    cout << -1 << '\n';
    return 0;
  } else {
    cout << 1 << '\n';
    return 0;
  }
  for (int i = 0; i < (int)(prms.size()); i++)
    if (!b[prms[i]]) {
      cout << prms[i] << '\n';
      break;
    }
  return 0;
}
