#include <bits/stdc++.h>
using namespace std;
vector<long long> x;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  x.assign(m, 0);
  for (int i = 0; i < m; ++i) {
    cin >> x[i];
  }
  int xf;
  cin >> xf;
  for (int i = 0; i < m; ++i) {
    x[i] = xf ^ x[i];
  }
  long long sd;
  int cnt, ans = 0;
  for (int i = 0; i < m; ++i) {
    cnt = 0;
    sd = 1;
    for (int j = 0; j < n; ++j) {
      if ((x[i] & sd) == sd) {
        cnt++;
      }
      sd *= 2;
    }
    if (cnt <= k) ans++;
  }
  cout << ans;
  return 0;
}
