#include <bits/stdc++.h>
using namespace std;
int cnt[30000];
int main() {
  int n;
  cin >> n;
  cnt[0] = 1;
  for (long long i = 0; i < n; ++i) {
    int a;
    cin >> a;
    for (long long q = 0; q < 30000 - a; ++q) {
      if (cnt[q] == 1) {
        cnt[q + a] = 1;
      }
    }
  }
  for (int i = 0; i < 30000; ++i) {
    if (cnt[i] == 0) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}
