#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  int a[10000];
  for (int i = 0; i <= m; i++) scanf("%d", &a[i]);
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    int x = a[i] ^ a[m];
    int c = 0;
    while (x) {
      c++;
      x = x & (x - 1);
    }
    if (c <= k) cnt++;
  }
  printf("%d\n", cnt);
  return 0;
}
