#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long int n) {
  if (n == 2) return true;
  for (long long int i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> v(m + 1);
  for (int i = 0; i <= m; ++i) {
    cin >> v[i];
  }
  int ans = 0;
  for (int i = (0); i < (m); i++) {
    if (__builtin_popcount(v[i] ^ v[m]) <= k) ans++;
  }
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
