#pragma GCC optimize("Ofast") #pragma GCC target("avx2") char*mmap(); #define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;} #define wt(v) {long _z=v;do*--wp=_z%10+48;while(_z/=10);} #define rep(v,e) for(long v=0;v=0;) long d[61][1920]; main(){ char*rp=mmap(0l,1l<<25,1,2,0,0ll); long a=0,b=0,n=0; for(long c;c=*rp++,c>=48;){ c&=1; a+=c; b+=c?n:0; ++n; } if(b>n*(n-1)-b){ b=n*(n-1)-b; } d[0][0]=1; rep(i,n){ rrep(j,a){ rep(k,b+1-i){ d[j+1][k+i]+=d[j][k]; } } } long z=d[a][b]; char wbuf[64],*wp=wbuf+sizeof wbuf; wt(z); write(1,wp,wbuf+sizeof wbuf-wp); _exit(0); }