#include <bits/stdc++.h>
using namespace std;
int judge(int, int, int, int);
int main() {
  int n, m, k;
  cin >> n;
  cin >> m;
  cin >> k;
  int sum = 0;
  int *army = (int *)malloc(sizeof(int) * (m + 1));
  for (int i = 0; i < m + 1; i++) cin >> army[i];
  for (int i = 0; i < m; i++) sum += judge(army[m], army[i], n, k);
  cout << sum << endl;
  return 0;
}
int judge(int a, int b, int size, int digit) {
  int sum = 0;
  for (int i = size; i > 0; i--) {
    if (a % 2 != b % 2) sum++;
    a /= 2;
    b /= 2;
  }
  if (sum <= digit)
    return 1;
  else
    return 0;
}
