#include <bits/stdc++.h>
using namespace std;
int n, m, k, frndz = 0, cnt = 0;
int arr[10000005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 0; i <= m; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < m; i++) {
    for (unsigned int j = 1 << 31; j > 0; j /= 2) {
      if ((arr[i] & j) != (arr[m] & j)) cnt++;
    }
    if (cnt <= k) frndz++;
    cnt = 0;
  }
  cout << frndz << endl;
  return 0;
}
