#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define REP(i,n) for(long (i)=0;(i)<(n);(i)++) #define FOR(i,a,b) for(long (i)=(a);(i)<(b);(i)++) #define RREP(i,a) for(long (i)=(a)-1;(i)>=0;(i)--) #define FORR(i,a,b) for(long (i)=(a)-1;(i)>=(b);(i)--) #define MOD 1000000007 #define PI acos(-1.0) #define DEBUG(C) cout< #define VL vector #define VD vector #define PII pair #define PDD pair #define PLL pair #define ALL(a) (a).begin(),(a).end() #define SORT(a) sort(ALL(a)) #define REVERSE(a) reverse(ALL(a)) #define MP make_pair #define FORE(a,b) for(auto &&a:b) typedef long long LL; typedef unsigned long long ULL; using namespace std; #define long LL long pow_mod(long a,long p){ if(p==0) return 1; if(p&1) return a*pow_mod(a,p-1)%MOD; long t=pow_mod(a,p/2)%MOD; return t*t%MOD; } int main(void){ int M; cin>>M; vector v; int in; while(cin>>in){ if(in==0) break; v.emplace_back(in); } int sum=accumulate(ALL(v),0); if(v.size()==1 && v.front()==0){ cout<<1<