#include <bits/stdc++.h>
using namespace std;
int n, m, k;
bitset<20> arr[1000];
int main() {
  cin >> n >> m >> k;
  int num, cnt = 0;
  for (int i = 0; i < m; i++) {
    cin >> num;
    arr[i] = bitset<20>(num);
  }
  cin >> num;
  bitset<20> fedor(num);
  bitset<20> res;
  for (int i = 0; i < m; i++) {
    res = fedor ^ arr[i];
    if (res.count() <= k) cnt++;
  }
  cout << cnt;
  return 0;
}
