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