#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000;
int n, m, k;
int a[maxn];
inline int count_bit_one(int x) {
  return x == 0 ? 0 : count_bit_one(x >> 1) + (x & 1);
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) scanf("%d", &a[i]);
  cin >> a[m];
  int target = a[m];
  int ans = 0;
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    int w = target ^ a[i];
    if (count_bit_one(w) <= k) ans++;
  }
  cout << ans;
  return 0;
}
