#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, tmp;
  cin >> n >> m >> k;
  int i, j, a[m + 1][n];
  for (i = 0; i < m + 1; i++) {
    for (j = 0; j < n; j++) {
      a[i][j] = 0;
    }
  }
  for (i = 0; i < m + 1; i++) {
    cin >> tmp;
    for (j = n - 1; j >= 0 && tmp != 0; j--) {
      a[i][j] = tmp % 2;
      tmp /= 2;
    }
  }
  int ans = 0, h;
  for (i = 0; i < m; i++) {
    h = 0;
    for (j = 0; j < n; j++) {
      if (a[m][j] != a[i][j]) h++;
    }
    if (h <= k) ans++;
  }
  cout << ans << endl;
  return 0;
}
