#include <bits/stdc++.h>
using namespace std;
int count_ones(int val) {
  int ans = 0;
  while (val > 0) {
    ans++;
    val = val & (val - 1);
  }
  return ans;
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int arr[m + 1];
  int ans = 0;
  for (int i = 0; i < m + 1; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < m; i++) {
    if (count_ones(arr[m] ^ arr[i]) <= k) ans++;
  }
  cout << ans;
  return 0;
}
