#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int _m = m;
  vector<int> vec;
  while (_m--) {
    int temp;
    cin >> temp;
    vec.push_back(temp);
  }
  int fedor;
  cin >> fedor;
  int total = 0;
  bitset<20> bFedor(fedor);
  for (int i = 0; i < vec.size(); i++) {
    int count = 0;
    bitset<20> b(vec[i]);
    for (int j = 0; j < 20; j++) {
      if (b[j] != bFedor[j]) {
        count++;
      }
    }
    if (count <= k) total++;
    count = 0;
  }
  cout << total << endl;
  return 0;
}
