#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int a[m + 1];
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  int x;
  cin >> x;
  int c = 0;
  for (int i = 0; i < m; i++) {
    int ans = x ^ a[i];
    int setbits = __builtin_popcount(ans);
    if (setbits <= k) c++;
  }
  cout << c << endl;
}
