#include <bits/stdc++.h>
using namespace std;
string toBinary(int n) {
  std::string binary = std::bitset<64>(n).to_string();
  return binary;
}
int diffB(int n, int k) {
  int num = 0;
  string str1 = toBinary(n);
  string str2 = toBinary(k);
  for (int i = 0; i < str1.length(); i++) {
    if (str1[i] != str2[i]) {
      num++;
    }
  }
  return num;
}
int main() {
  int n, m, k, t, num;
  cin >> n >> m >> k;
  vector<int> players;
  for (int i = 0; i <= m; i++) {
    cin >> t;
    players.push_back(t);
  }
  num = 0;
  for (int i = 0; i < players.size() - 1; i++) {
    if (diffB(players[i], players[players.size() - 1]) <= k) {
      num++;
    }
  }
  cout << num << endl;
  return 0;
}
