#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
bool cmp(int a, int b)
{
return a > b;
}
int main()
{
int n;
int a[1010];
while (scanf("%d", &n) != EOF)
{
int f = 1;
if (n == 0) break;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
if (a[i] < 2)
{
f = 0;
}
}
if (f == 0)
{
printf("-1\n");
}
if (f == 1)
{
sort(a + 1, a + n + 1, cmp);
int ans = 0;
for (int i = 1; i < n; i++)
{
ans += a[i];
}
ans = ans + 2;
printf("%d\n", ans);
}
}
return 0;
}