#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996);
int n, m, k;
int compare(int a, int b) {
  int ans = 0;
  vector<int> f(n + 1, 0), s(n + 1, 0);
  int i = 0;
  while (a != 0) {
    f[i] = a % 2;
    a /= 2;
    i++;
  }
  i = 0;
  while (b != 0) {
    s[i] = b % 2;
    b /= 2;
    i++;
  }
  for (i = 0; i < f.size(); i++) {
    ans += f[i] != s[i];
  }
  return ans;
}
int main() {
  cin >> n >> m >> k;
  vector<int> p(m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &p[i]);
  }
  int cmpr;
  cin >> cmpr;
  int res = 0;
  for (int i = 0; i < m; i++) {
    if (compare(p[i], cmpr) <= k) res++;
  }
  cout << res;
  return 0;
}
