#include <bits/stdc++.h>
using namespace std;
int k, n, V, arr[1 << 20], dd;
int main() {
  cin >> dd >> n >> k;
  for (int j = 1; j <= n; j++) cin >> arr[j];
  cin >> V;
  int ans = 0;
  for (int j = 1; j <= n; j++) {
    int dif = 0;
    for (int i = 0; i < 25; i++)
      if ((((1 << i) & V) ^ ((1 << i) & arr[j]))) dif++;
    if (dif <= k) ans++;
  }
  cout << ans << endl;
}
