#include <bits/stdc++.h>
using namespace std;
int a[1002], b[20], c[20];
int main() {
  int n, m, k, y, s = 0;
  cin >> n >> m >> k;
  for (int i = 0; i <= m; i++) cin >> a[i];
  for (int i = 0; i < 20; i++) {
    b[i] = 0;
    c[i] = 0;
  }
  int x = a[m];
  for (int i = 0; x > 0; i++) {
    y = x % 2;
    b[i] = y;
    x = x / 2;
  }
  for (int i = 0; i < m; i++) {
    int z = k;
    for (int j = 0; a[i] > 0; j++) {
      y = a[i] % 2;
      c[j] = y;
      a[i] = a[i] / 2;
    }
    for (int o = 0; o < 20; o++) {
      if (b[o] != c[o]) z--;
    }
    if (z >= 0) s++;
    for (int p = 0; p < 20; p++) {
      c[p] = 0;
    }
  }
  cout << s << endl;
  return 0;
}
