#include <bits/stdc++.h>
using namespace std;
int bit_count(long long int a) {
  int c = 0;
  while (a) {
    c += (a & 0x1u);
    a >>= 1;
  }
  return c;
}
int main() {
  int n, m, k;
  long long fed;
  cin >> n >> m >> k;
  long long int arr[m + 2];
  for (int i = 0; i < m; i++) cin >> arr[i];
  cin >> fed;
  int c = 0;
  for (int i = 0; i < m; i++) {
    if (bit_count(arr[i] ^ fed) <= k) c++;
  }
  cout << c << endl;
  return 0;
}
