#include <bits/stdc++.h>
using namespace std;
long long n, m, k, ar[1100], vis[40];
int main() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= m; i++) cin >> ar[i];
  long long p;
  cin >> p;
  for (long long i = 0; i < n; i++) {
    if ((1 << i & p) > 0) vis[i] = 1;
  }
  long long ans = 0;
  for (long long i = 1; i <= m; i++) {
    long long cn = 0;
    for (long long j = 0; j < n; j++) {
      if (((1 << j) & ar[i]) > 0) {
        if (vis[j] == 0) cn++;
      } else {
        if (vis[j] == 1) cn++;
      }
    }
    if (cn <= k) ans++;
  }
  cout << ans << endl;
  return 0;
}
