#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, k, s, q = 0, b = 0, ans = 0;
  cin >> n >> m >> k;
  long long ar[m + 1][50];
  memset(ar, 0, sizeof(ar[0][0]) * (m + 1) * (50));
  for (int a = 0; a < m + 1; a++) {
    b = 0;
    cin >> s;
    while (s > 0) {
      if (s % 2 == 1) ar[a][b] = 1;
      s /= 2;
      b++;
    }
  }
  for (int a = 0; a < m; a++) {
    q = 0;
    for (int b = 0; b < n; b++) {
      if (ar[m][b] != ar[a][b]) q++;
    }
    if (q <= k) ans++;
  }
  cout << ans;
  return 0;
}
