#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j = 0, k, sum = 0, m, a, num = 0;
  int s[1005][25] = {0};
  cin >> n >> m >> k;
  for (i = 1; i <= m + 1; i++) {
    j = 0;
    cin >> a;
    while (a > 0) {
      s[i][j] = a % 2;
      j++;
      a /= 2;
    }
  }
  for (i = 1; i < m + 1; i++) {
    sum = 0;
    for (j = 0; j < 20; j++)
      if (s[i][j] != s[m + 1][j]) sum++;
    if (sum <= k) num++;
  }
  cout << num;
  return 0;
}
