#include <bits/stdc++.h>
int main() {
  int n, m, k, x1, x2;
  scanf("%d %d %d", &n, &m, &k);
  int a[m + 1];
  for (int i = 0; i <= m; i++) scanf("%d", &a[i]);
  long long int c = 0, f = 0;
  for (int i = 0; i < m; i++) {
    x1 = a[i];
    x2 = a[m];
    while (x1 != 0 || x2 != 0) {
      {
        if ((x1 % 2) ^ (x2 % 2) == 1) c++;
        x1 = x1 >> 1;
        x2 = x2 >> 1;
      }
    }
    if (c <= k) f++;
    c = 0;
  }
  printf("%lld", f);
  return 0;
}
