#include <bits/stdc++.h>
using namespace std;
int q[1001];
int foo(int a, int b) {
  int tmp = a ^ b;
  int res = 0;
  for (int i = 0; i < 20; i++) {
    if (tmp % 2) res++;
    tmp /= 2;
  }
  return res;
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int tmp;
  int res = 0;
  for (int i = 0; i <= m; i++) {
    scanf("%d", &q[i]);
  }
  for (int i = 0; i < m; i++) {
    tmp = foo(q[i], q[m]);
    if (tmp <= k) res++;
  }
  printf("%d", res);
  return 0;
}
