#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)(1e5 + 1e1);
const double PI = acos(-1.0);
long long ans, t, k, n, m, q = 1, a[MAXN], b[MAXN], c[MAXN];
bool e;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 1; i <= m + 1; i++) {
    cin >> a[i];
  }
  while (a[m + 1] > 0) {
    t = a[m + 1] % 2;
    a[m + 1] /= 2;
    q++;
    if (t == 1) {
      if (q != n)
        b[q % n] = 1;
      else
        b[n] = 1;
    }
  }
  for (int i = 1; i <= m; i++) {
    long long w = 0;
    t = 0, q = 1;
    while (a[i] > 0) {
      t = a[i] % 2;
      a[i] /= 2;
      q++;
      if (t == 1) {
        if (q != n)
          c[q % n] = 1;
        else
          c[n] = 1;
      }
    }
    for (int j = 1; j <= n; j++) {
      if (c[j] != b[j]) w++;
      if (w > k) {
        e = 0;
        break;
      } else
        e = 1;
    }
    if (e) ans++;
    fill(c + 1, c + n + 1, 0);
  }
  cout << ans;
  return 0;
}
