#include <bits/stdc++.h>
using namespace std;
void testcase() {
  int n, m, k;
  cin >> n >> m >> k;
  int a[m + 1];
  for (int i = 0; i <= m; i++) {
    cin >> a[i];
  }
  int friends = 0;
  for (int i = 0; i < m; i++) {
    int val = a[m] ^ a[i];
    if (__builtin_popcount(val) <= k) friends++;
  }
  cout << friends << "\n";
}
int main() {
  int t = 1;
  while (t--) {
    testcase();
  }
  return 0;
}
