#include <bits/stdc++.h>
using namespace std;
int countSetBits(int n) {
  int count = 0;
  while (n) {
    count += n & 1;
    n >>= 1;
  }
  return count;
}
int main() {
  int n, m, k, count = 0, i;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &k);
  long long x[m + 1];
  for (i = 0; i <= m; i++) {
    cin >> x[i];
  }
  for (i = 0; i < m; i++) {
    if (countSetBits(x[m] ^ x[i]) <= k) count++;
  }
  printf("%d ", count);
}
