#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, v[1001], i, cnt = 0, w = 0, q;
  cin >> n >> m >> k;
  for (i = 1; i <= m + 1; i++) cin >> v[i];
  for (i = 1; i <= m; i++) {
    q = v[i] ^ v[m + 1];
    while (q) {
      if (q & 1) cnt++;
      q = q >> 1;
    }
    if (cnt <= k) w++;
    cnt = 0;
  }
  cout << w;
  return 0;
}
