#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int ar[m + 1];
  for (int i = 0; i <= m; i++) {
    cin >> ar[i];
  }
  int count = 0;
  int fe = ar[m];
  for (int i = 0; i < m; i++) {
    int kk = fe ^ ar[i];
    int bit = __builtin_popcount(kk);
    if (bit <= k) count++;
  }
  cout << count;
  return 0;
}
