#include #include #include using namespace atcoder; using mint = modint; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 2000000000000000005 int main(){ int N,K; cin>>N>>K; int cur = 1; rep(i,K)cur *= 5; vector a(cur,0); rep(i,N){ string t; cin>>t; int v = 0; int cc = 1; rep(j,K){ v += cc * (t[j]-'0'); cc *= 5; } a[v] ++; } vector dp = a; cur = 1; rep(i,K){ vector ndp(dp.size(),0); rep(j,dp.size()){ int jj = j/cur % 5; for(int k=jj;k<=4;k++){ ndp[j] += dp[j + cur * (k-jj)]; } } swap(dp,ndp); cur *= 5; } int ans = 0; rep(i,a.size()){ if(a[i]==0)continue; if(dp[i]!=1)ans++; } cout<