#include using namespace std; using ll=long long; using pp=pair; #define sr string #define vc vector #define db double #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) int main(){ int n,k;cin>>n>>k; int b=1; rep(i,k)b*=5; vcf(k+1,1); rep(i,k)f[i+1]=f[i]*5; vcxs(n); rep(i,n){ int x=0; sr ss;cin>>ss; rep(j,k){ int a=ss[j]-'0'; x+=f[j]*a; } xs[i]=x; } vcs(f[k]-1,0); rep(i,n)s[xs[i]]++; rep(i,k)for(int j=f[k]-1;j>=0;j--){ if((j/f[i])%5!=4)s[j]+=s[j+f[i]]; } int ans=0; rep(i,n)if(s[xs[i]]>1)ans++; cout<