#include <bits/stdc++.h>
using namespace std;
int f(int, int);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  int a[m + 1];
  int c[m];
  int b = 0;
  for (int i = 0; i < m; i++) {
    c[i] = 0;
  }
  for (int i = 0; i <= m; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    for (int j = 1; j <= n; j++) {
      if (f(a[i], j) != f(a[m], j)) c[i]++;
    }
    if (c[i] <= k) b++;
  }
  cout << b;
  return (0);
}
int f(int q, int w) {
  int e = q;
  for (int i = 1; i < w; i++) {
    e = e / 2;
  }
  return (e % 2);
}
