#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, k, sum1 = 0, sum = 0;
  cin >> n >> m >> k;
  long long int a[m + 1], x[m], b[64];
  for (int i = 0; i < m + 1; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    x[i] = (a[i] ^ a[m]);
    sum1 = 0;
    for (int j = 0; j < 64; j++) {
      b[j] = 0;
    }
    int j = 0;
    while (x[i] != 0) {
      b[j] = x[i] % 2;
      x[i] = x[i] / 2;
      ++j;
    }
    for (int j = 0; j < 64; j++)
      if (b[j] == 1) {
        sum1++;
      }
    if (sum1 <= k) {
      sum++;
    }
  }
  cout << sum;
}
