#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m, k, count = 0;
  cin >> n >> m >> k;
  int player[m + 1];
  for (int i = 0; i <= m; i++) cin >> player[i];
  bitset<20> Fedor(player[m]);
  string s1 = Fedor.to_string();
  for (int i = 0; i < m; i++) {
    int totalk = 0;
    bitset<20> army(player[i]);
    string s2 = army.to_string();
    for (int i = 0; i < s1.size(); i++) {
      if (s1[i] != s2[i]) totalk++;
    }
    if (totalk <= k) count++;
  }
  cout << count << endl;
}
