#include <bits/stdc++.h>
using namespace std;
int count(int v) {
  int num = 0;
  while (v) {
    v &= (v - 1);
    num++;
  }
  return num;
}
int OR(int a, int b) { return a ^ b; }
int cal(int x, int y) {
  int s = OR(x, y);
  return count(s);
}
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  int aa[1010];
  for (int i = 0; i <= m; i++) scanf("%d", &aa[i]);
  int ans = 0;
  for (int i = 0; i <= m - 1; i++) {
    if (cal(aa[i], aa[m]) <= k) ans++;
  }
  printf("%d\n", ans);
}
