#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int a[m];
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  int s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < m; i++) {
    if (__builtin_popcount(s ^ a[i]) <= k) ans++;
  }
  cout << ans << endl;
  return 0;
}
