#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  while (cin >> n >> m >> k) {
    int ar[1010];
    for (int i = 0; i <= m; i++) {
      cin >> ar[i];
    }
    int sum = 0;
    for (int j = 0; j < m; j++) {
      int xo = (ar[m]) ^ (ar[j]);
      int tem = 0;
      while (xo > 0) {
        int a = xo % 2;
        if (a) tem++;
        xo /= 2;
      }
      if (tem <= k) sum++;
    }
    cout << sum << endl;
  }
  return 0;
}
