#include <bits/stdc++.h>
using namespace std;
using bigint = long long int;
using vi = vector<int>;
using vll = vector<long long int>;
int countSetBits(int N) {
  int counter = 0;
  while (N > 0) {
    counter++;
    N = N & (N - 1);
  }
  return counter;
}
int main() {
  int N, M, K;
  cin >> N >> M >> K;
  int arr[M + 2];
  for (int i = 0; i <= M; i++) {
    cin >> arr[i];
  }
  int X = arr[M];
  int ans = 0;
  for (int i = 0; i < M; i++) {
    int common = countSetBits(X ^ arr[i]);
    if (common <= K) ans++;
  }
  cout << ans << "\n";
  return 0;
}
