#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
bool countones(long long fuck) {
  int dndn = 0;
  for (;;) {
    if (fuck % 2 == 1) dndn++;
    if (fuck < 2) break;
    fuck = fuck / 2;
  }
  return (k >= dndn);
}
int main() {
  long long x[1020];
  cin >> n >> m >> k;
  for (long long i = 0; i <= m; i++) cin >> x[i];
  long long dndn, ans = 0;
  for (long long i = 0; i < m; i++) {
    dndn = x[i] ^ x[m];
    if (countones(dndn)) ans++;
  }
  cout << ans << endl;
  return 0;
}
