#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define fi first #define se second #define rep(i,n) for(int i = 0; i < (n); ++i) #define rrep(i,n) for(int i = 1; i <= (n); ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) #define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next) #define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++) #define rng(a) a.begin(),a.end() #define maxs(x,y) x = max(x,y) #define mins(x,y) x = min(x,y) #define pb push_back #define sz(x) (int)(x).size() #define pcnt __builtin_popcount #define uni(x) x.erase(unique(rng(x)),x.end()) #define snuke srand((unsigned)clock()+(unsigned)time(NULL)); #define df(x) int x = in() #define dame { puts("0"); return 0;} #define show(x) cout<<#x<<" = "< P; typedef vector vi; typedef vector vvi; typedef vector vl; typedef vector

vp; inline int in() { int x; scanf("%d",&x); return x;} inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');} templateistream& operator>>(istream&i,vector&v) {rep(j,sz(v))i>>v[j];return i;} templatestring join(vector&v) {stringstream s;rep(i,sz(v))s<<' '<ostream& operator<<(ostream&o,vector&v) {if(sz(v))o<istream& operator>>(istream&i,pair&v) {return i>>v.fi>>v.se;} templateostream& operator<<(ostream&o,pair&v) {return o<=mod) x-=mod; return *this;} mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;} mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;} mint& operator/=(const mint& a){ (x*=ex(a,mod-2).x)%=mod; return *this;} mint operator+(const mint& a)const{ return mint(*this) += a;} mint operator-(const mint& a)const{ return mint(*this) -= a;} mint operator*(const mint& a)const{ return mint(*this) *= a;} mint operator/(const mint& a)const{ return mint(*this) /= a;} bool operator<(const mint& a)const{ return x < a.x;} bool operator==(const mint& a)const{ return x == a.x;} }; istream& operator>>(istream&i,mint&a){i>>a.x;return i;} ostream& operator<<(ostream&o,const mint&a){o< vm; mint ex(mint a, ll tms) { if(!tms) return 1; mint res = ex(a,tms/2); res *= res; return (tms&1)?res*a:res; } struct comb { vm f, g; comb(){} comb(int mx):f(mx+1),g(mx+1) { f[0] = 1; rrep(i,mx) f[i] = f[i-1]*i; g[mx] = ex(f[mx],mod-2); for(int i=mx;i>0;i--) g[i-1] = g[i]*i; } mint c(int a, int b) { if (a < b) return 0; return f[a]*g[b]*g[a-b]; } }; // int main() { int n, m = 0; scanf("%d",&n); int a, x = 0; while (scanf("%d",&a) == 1) { ++m; n -= a+1; x |= !a; } if (x) { cout<<1<