#include <cstdio>
#include <cstring>
char c[52][52];
int main(){
int max = 0, cnt = 0;
int n, m, l;
int cnt2;
scanf("%d%d", &n, &m);
for(int i = 0; i < n; i++){
scanf("%s", c[i]);
}
scanf("%d", &l);
for (int i = 0; i < n; i++){
cnt = 0;
cnt2 = 0;
for (int k = 0; k < m; k++) if(c[i][k] == '0') cnt2++;
if (cnt2 <= l && cnt2 % 2 == l % 2) {
for (int j = 0; j < n; j++){
if (strcmp(c[i], c[j]) == 0) cnt++;
}
}
max = max < cnt ? cnt : max;
}
printf("%d\n",max);
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGNzdHJpbmc+CmNoYXIgY1s1Ml1bNTJdOwppbnQgbWFpbigpewogIGludCBtYXggPSAwLCBjbnQgPSAwOwogIGludCBuLCBtLCBsOwogIGludCBjbnQyOwogIHNjYW5mKCIlZCVkIiwgJm4sICZtKTsKICBmb3IoaW50IGkgPSAwOyBpIDwgbjsgaSsrKXsKICAgIHNjYW5mKCIlcyIsIGNbaV0pOwogIH0KICBzY2FuZigiJWQiLCAmbCk7CiAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspewogICAgY250ID0gMDsKICAgIGNudDIgPSAwOwogICAgZm9yIChpbnQgayA9IDA7IGsgPCBtOyBrKyspIGlmKGNbaV1ba10gPT0gJzAnKSBjbnQyKys7CiAgICBpZiAoY250MiA8PSBsICYmIGNudDIgJSAyID09IGwgJSAyKSB7CiAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgbjsgaisrKXsKICAgICAgICBpZiAoc3RyY21wKGNbaV0sIGNbal0pID09IDApIGNudCsrOwogICAgICB9CiAgICB9CiAgICBtYXggPSBtYXggPCBjbnQgPyBjbnQgOiBtYXg7CiAgfQogIHByaW50ZigiJWRcbiIsbWF4KTsKfQo=