#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, a[10000], minimum, maximum, f, c = 0;
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) cin >> a[i];
  cin >> f;
  for (int i = 0; i < m; i++) {
    if (__builtin_popcount(a[i] ^ f) <= k) c++;
  }
  cout << c << "\n";
  return 0;
}
