#include <bits/stdc++.h>
using namespace std;
string convert(int n, int bits) {
  string nw;
  while (nw.size() != bits) {
    if (n % 2 != 0)
      nw += '1';
    else
      nw += '0';
    n /= 2;
  }
  reverse(nw.begin(), nw.end());
  return nw;
}
int cmp(string s, string t, int bits) {
  int ans = 0;
  for (int i = 0; i < bits; i++) {
    if (s[i] != t[i]) ans++;
  }
  return ans;
}
int main() {
  int bit, n, k;
  cin >> bit >> n >> k;
  int arr[n + 1];
  for (int i = 0; i < n + 1; i++) {
    cin >> arr[i];
  }
  int ans = 0;
  string s = convert(arr[n], bit);
  for (int i = 0; i < n; i++) {
    string ss = convert(arr[i], bit);
    int x = cmp(s, ss, bit);
    if (x <= k) ans++;
  }
  cout << ans;
}
