#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int ctr;
int bit;
int main() {
  scanf("%d %d %d", &n, &m, &k);
  m += 1;
  int sd[m];
  for (int i = 0; i < m; i++) {
    scanf("%d", &sd[i]);
  }
  ctr = 0;
  for (int i = 0; i < m - 1; i++) {
    bit = 0;
    for (int j = 0; j < n; j++) {
      if (((1 << j) & sd[i]) != ((1 << j) & sd[m - 1])) {
        bit++;
      }
    }
    if (bit <= k) ctr++;
  }
  printf("%d\n", ctr);
  return 0;
}
