#include <bits/stdc++.h>
using namespace std;
vector<int> bin(int num, int typs) {
  vector<int> v;
  while (num > 0) {
    v.push_back(num % 2);
    num /= 2;
  }
  for (int i = v.size(); i < typs; i++) {
    v.push_back(0);
  }
  return v;
}
int main() {
  int typs, plyrs, diff, cnt = 0, diffbit = 0;
  cin >> typs >> plyrs >> diff;
  int army;
  vector<vector<int> > v;
  for (int i = 0; i <= plyrs; i++) {
    cin >> army;
    v.push_back(bin(army, typs));
  }
  for (int i = 0; i < v.size() - 1; i++) {
    diffbit = 0;
    for (int j = 0; j < v[i].size(); j++) {
      if (v[i][j] != v[v.size() - 1][j]) diffbit++;
    }
    if (diffbit <= diff) cnt++;
  }
  cout << cnt;
  return 0;
}
