#include <bits/stdc++.h>
int num_of_zero(int num) {
  if (0 == num) return 1;
  int Count = 0;
  while (num > 0) {
    if (0 == (num & 1)) Count++;
    num >>= 1;
  }
  return Count;
}
int check(int a, int b) {
  int i, j, count = 0;
  while (a != 0 || b != 0) {
    if ((a & 1) == 1 && (b & 1) == 1 || (a & 1) == 0 && (b & 1) == 0) {
      a >>= 1;
      b >>= 1;
    } else {
      count++;
      a >>= 1;
      b >>= 1;
    }
  }
  return count;
}
int main() {
  int i, j, k, n, m, val, count = 0, num;
  scanf("%d %d %d", &n, &m, &k);
  int a[m];
  for (i = 0; i < m; i++) scanf("%d", &a[i]);
  scanf("%d", &val);
  for (i = 0; i < m; i++) {
    num = check(a[i], val);
    if (num <= k) count++;
  }
  printf("%d", count);
  return 0;
}
