#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, counter = 0;
  cin >> n >> m >> k;
  vector<int> v(m + 1);
  for (int i = 0; i <= m; ++i) cin >> v[i];
  for (int i = 0; i < m; ++i) {
    int ans = (v[i] ^ v[m]), sum = 0;
    while (ans > 0) {
      ans = ans & (ans - 1);
      ++sum;
    }
    if (sum <= k) ++counter;
  }
  cout << counter;
}
