#include <bits/stdc++.h>
using namespace std;
int a[1001];
int main() {
  int m, p, n, i, k, s = 0, ans = 0, l = 0, d;
  cin >> n >> m >> k;
  for (i = 0; i <= m; i++) {
    cin >> a[i];
  }
  for (i = 0; i < m; i++) {
    p = (a[i] | a[m]);
    d = (a[i] & a[m]);
    while (p != 0) {
      if ((p & 1) == 1) {
        s++;
      }
      p = p >> 1;
    }
    while (d != 0) {
      if ((d & 1) == 1) {
        l++;
      }
      d = d >> 1;
    }
    if (s - l <= k) {
      ans++;
    }
    s = 0;
    l = 0;
  }
  cout << ans;
}
