int@M,@N,r[N];bitset<4096>b,n[N]{};rep(j,M){cin>>b;rep(i,N)b[i]?n[i]|=~b:b;}unionFind u{'m',N,1};rep(i,N)rep(j,N)if(!n[i][j])u(i,j);wt(u.comp(r));