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