#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n, k;
  cin >> n >> m >> k;
  int arr[int(1e3) + 5];
  for (int i = 0; i < m + 1; i++) {
    cin >> arr[i];
  }
  int cnt = 0;
  int friends = 0;
  for (int i = 0; i < m; i++) {
    int num = arr[m] ^ arr[i];
    for (int j = 0; j < 32; j++) {
      if (1 << j & num) cnt++;
    }
    if (cnt <= k) {
      friends++;
    }
    cnt = 0;
  }
  cout << friends << endl;
  return 0;
}
