#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, n, s = 0, cnt = 0, k, i, m;
  scanf("%d%d%d", &a, &m, &k);
  int ara[m];
  for (i = 0; i < m; i++) scanf("%d", &ara[i]);
  scanf("%d", &b);
  for (i = 0; i < m; i++) {
    a = ara[i];
    n = a ^ b;
    s = 0;
    while (n != 0) {
      if (n % 2 != 0) {
        n = n - 1;
        s = s + 1;
      }
      n = n / 2;
    }
    if (s <= k) cnt = cnt + 1;
  }
  printf("%d", cnt);
  return 0;
}
