#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 5;
const int INF = 0x7fffff;
int a[MAX];
int n, m, k, f;
bool judge(int x) {
  int ans = 0;
  while (x) {
    if (x & 1) ans++;
    x >>= 1;
  }
  if (ans <= k) return true;
  return false;
}
int main(int argc, char const *argv[]) {
  cin >> n >> m >> k;
  for (int i = 0; i < m; ++i) cin >> a[i];
  cin >> f;
  int ans = 0;
  for (int i = 0; i < m; ++i)
    if (judge(a[i] ^ f)) ans++;
  cout << ans << endl;
  return 0;
}
