#include <bits/stdc++.h>
using namespace std;
int ar[1007];
int main() {
  int n, m, k, a, b, r = 0;
  cin >> n >> m >> k;
  for (int i = 0; i <= m; i++) cin >> ar[i];
  for (int i = 0; i < m; i++)
    if (__builtin_popcount(ar[i] ^ ar[m]) <= k) r++;
  cout << r << endl;
  return 0;
}
