#include int main () { int n = 0; int k = 0; char s[9] = ""; int res = 0; int ans = 0; int val[200000] = {}; int cnt[400000] = {}; int pow[9] = {}; res = scanf("%d", &n); res = scanf("%d", &k); for (int i = 0; i < n; i++) { res = scanf("%s", s); for (int j = 0; j < k; j++) { val[i] = val[i]*5+4-((int)(s[j]-'0')); } cnt[val[i]]++; } pow[0] = 1; for (int i = 1; i <= k; i++) { pow[i] = pow[i-1]*5; } for (int i = 0; i < k; i++) { for (int j = 0; j < pow[k]; j++) { if ((j/pow[i])%5 > 0) { cnt[j] += cnt[j-pow[i]]; } } } for (int i = 0; i < n; i++) { if (cnt[val[i]] > 1) { ans++; } } printf("%d\n", ans); return 0; }