#include <bits/stdc++.h>
using namespace std;
void Fast_Code() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
int Count_ones(int n) {
  int counter = 0;
  while (n) {
    n = n & (n - 1);
    counter++;
  }
  return counter;
}
int a[1005];
int main() {
  Fast_Code();
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i <= m; i++) cin >> a[i];
  int ans = 0;
  for (int i = 0; i < m; i++) {
    if (Count_ones(a[i] ^ a[m]) <= k) ans++;
  }
  cout << ans << endl;
}
