#include <bits/stdc++.h>
using namespace std;
string tobinary(long long int n) {
  string ans;
  long long int x;
  while (n) {
    x = n % 2;
    ans += to_string(x);
    n /= 2;
  }
  reverse(ans.begin(), ans.end());
  return ans;
}
int main() {
  std::ios::sync_with_stdio(false);
  long long int n, m, k;
  std::cin >> n >> m >> k;
  long long int a[m + 1];
  for (long long int i = 0; i < m + 1; i++) std::cin >> a[i];
  long long int x = a[m], z = 0, temp, on;
  string s;
  for (long long int i = 0; i < m; i++) {
    on = 0;
    temp = (a[i] ^ x);
    s = tobinary(temp);
    for (long long int j = 0; j < s.length(); j++) {
      if (s[j] == '1') on++;
    }
    if (on <= k) z++;
  }
  std::cout << z << '\n';
  return 0;
}
