#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int setBits(int n) {
  int c = 0;
  while (n) {
    n &= n - 1;
    c++;
  }
  return c;
}
int main(int argc, char const *argv[]) {
  int n, m, k, c = 0;
  cin >> n >> m >> k;
  vector<int> x(m);
  for (int i = 0; i < m; i++) cin >> x[i];
  int fedor;
  cin >> fedor;
  for (int i = 0; i < m; i++) {
    int p = fedor ^ x[i];
    if (setBits(p) <= k) c++;
  }
  cout << c;
  return 0;
}
