#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  long long a[m + 1];
  for (int i = 0; i < (int)(m + 1); ++i) cin >> a[i];
  long long f = a[m];
  long long ans = 0;
  for (int i = 0; i < (int)(m); ++i) {
    long long s = a[i] ^ f;
    long long count = 0;
    while (s) {
      count += s & 1;
      s = s >> 1;
    }
    if (count <= k) ans++;
  }
  cout << ans;
  return 0;
}
