#include <bits/stdc++.h>
using namespace std;
bool atmost(int bits, int fred, int most) {
  int cnt = 0;
  while (max(bits, fred)) {
    if (bits % 2 != fred % 2) cnt++;
    bits /= 2;
    fred /= 2;
  }
  return (cnt > most) ? 0 : 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> players(m + 1);
  for (int i = 0; i < players.size(); i++) {
    cin >> players[i];
  }
  int ans = 0;
  for (int i = 0; i < m; i++) {
    ans += atmost(players[i], players[m], k);
  }
  cout << ans;
  return 0;
}
