#include <bits/stdc++.h>
using namespace std;
long long int M = 1e9 + 7;
long long int inf = 9 * 1e18;
const double PI = acos(-1);
long long int n, m;
long long int binpow(long long int val, long long int deg) {
  if (deg < 0) return 0;
  if (!deg) return 1 % M;
  if (deg & 1) return binpow(val, deg - 1) * val % M;
  long long int res = binpow(val, deg >> 1);
  return (res * res) % M;
}
long long int modinv(long long int n) { return binpow(n, M - 2); }
int readbit(int n, int pos) {
  unsigned int mask, temp;
  mask = 1 << pos;
  temp = n & mask;
  if (temp == 0) {
    return 0;
  } else {
    return 1;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int i, j, t, k, x, y, z, N, m, ans = 0;
  cin >> n >> m >> k;
  int arr[m];
  for (int i = 1; i <= m + 1; i++) {
    cin >> arr[i];
  }
  for (int i = 1; i < m + 1; i++) {
    long long int count = 0;
    int x = (arr[m + 1] ^ arr[i]);
    for (int i = n - 1; i >= 0; i--) {
      if (readbit(x, i)) count += readbit(x, i);
    }
    if (count <= k) ans++;
  }
  cout << ans;
  return 0;
}
