#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
const int maxn=1e3;
using namespace std;
int main()
{
int b,c,t,n,m;
int a[maxn];
while(cin>>n&&n!=0)
{
int flag=1,sum=0;
for(int i=0;i<n;++i)
{
cin>>a[i];
if(a[i]<2) flag=0;
sum+=a[i];
}
sort(a,a+n);
if(flag==0) printf("-1\n");
else printf("%d\n",sum-a[0]+2);
}
}