#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  scanf("%d", &N);
  vector<int> x(1000004, 0);
  vector<int> xx;
  for (int XYZtimes = 0; XYZtimes < N; XYZtimes++) {
    int tmp;
    scanf("%d", &tmp);
    xx.push_back(tmp);
    x[tmp] = 1;
  }
  for (int i = 1; i <= 1000; i++) {
    if (x[i] == 0) {
      for (auto aa : xx) {
        if (i - aa >= 0 and x[i - aa]) {
          x[i] = 1;
        }
      }
    }
  }
  for (int i = 1; i <= 1000; i++) {
    if (!x[i]) {
      return printf("%d\n", i), 0;
    }
  }
  return printf("%d\n", -1), 0;
}
