#include <bits/stdc++.h>
using namespace std;
int solve(int A, int B) {
  int count = 0;
  for (int i = 0; i < 32; i++) {
    if (((A >> i) & 1) != ((B >> i) & 1)) {
      count++;
    }
  }
  return count;
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  std::vector<int> arr(m + 1);
  for (size_t i = 0; i < m + 1; i++) {
    cin >> arr[i];
  }
  int count = 0;
  for (size_t i = 0; i < m; i++) {
    int ans;
    ans = solve(arr[i], arr[m]);
    if (ans <= k) {
      count++;
    }
  }
  std::cout << count << '\n';
  return 0;
}
