#include <bits/stdc++.h>
using namespace std;
int check(int a, int b, int k) {
  int diff = 0;
  for (int i = 0; i < 32; i++) {
    if ((a & (1 << i)) != (b & (1 << i))) diff++;
    if (diff > k) return 0;
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(m);
  for (int i = 0; i < m; i++) cin >> a[i];
  int last;
  cin >> last;
  int ans = 0;
  for (int i = 0; i < m; i++) {
    int q = check(a[i], last, k);
    if (q == 1) ans++;
  }
  cout << ans;
  return 0;
}
