#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int count = 0;
  int a[m + 1];
  for (int i = 0; i <= m; i++) {
    cin >> a[i];
  }
  int anscount = 0;
  int base = a[m];
  for (int i = 0; i < m; i++) {
    a[m] = base;
    int count = 0;
    for (int j = 0; j < n; j++) {
      if (((a[i] >> j) & 1) != ((a[m] >> j) & 1)) {
        count++;
      }
    }
    if (count <= k) anscount++;
  }
  cout << anscount;
}
