#include <bits/stdc++.h>
using namespace std;
unsigned int getn() {
  unsigned int h;
  scanf("%u", &h);
  return h;
}
int main() {
  unsigned int n = getn();
  unsigned int m = getn();
  unsigned int k = getn();
  unsigned int ans = 0;
  vector<int> V;
  for (int i = 0; i < m + 1; i++) {
    V.push_back(getn());
  }
  for (int i = 0; i < m; i++) {
    if (__builtin_popcount(V[i] ^ V[m]) <= k) ans++;
  }
  printf("%d\n", ans);
}
