#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, cnt = 0;
  cin >> n >> m >> k;
  int arr[m];
  for (int i = 0; i < m; i++) cin >> arr[i];
  int fedor;
  cin >> fedor;
  for (int i = 0; i < m; i++) {
    int XOR = fedor ^ arr[i];
    int diff = 0;
    for (int i = 0; i < n; i++) {
      if (XOR & (1 << i)) {
        diff++;
      }
    }
    if (diff <= k) {
      cnt++;
    }
  }
  cout << cnt;
}
