#include <bits/stdc++.h>
using namespace std;
int n, m, k = 20;
struct ele {
  int data;
  int b[100] = {0};
};
int main() {
  cin >> n >> m >> k;
  struct ele a[m + 1];
  for (int i = 0; i < m + 1; i++) {
    cin >> a[i].data;
    int x = a[i].data;
    int l = 99;
    while (x != 0) {
      a[i].b[l] = x % 2;
      x /= 2;
      l--;
    }
  }
  int count = 0;
  for (int i = 0; i < m; i++) {
    int flag = 0;
    for (int j = 99; j >= 0 && flag <= k; j--) {
      if (a[i].b[j] != a[m].b[j]) flag++;
    }
    if (flag <= k) count++;
  }
  cout << count << endl;
  return 0;
}
