#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m, k;
  cin >> n >> m >> k;
  vector<long long> a(m + 1);
  for (auto &it : a) cin >> it;
  int count = 0;
  for (int i = 0; i < m; i++) {
    if (__builtin_popcountll(a[i] ^ a[m]) <= k) count++;
  }
  cout << count << endl;
}
