#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, i;
  cin >> n >> m >> k;
  bitset<21> a[m + 2];
  for (i = 1; i <= m + 1; i++) {
    int x;
    cin >> x;
    a[i] = bitset<21>(x);
  }
  int cnt = 0;
  for (i = 1; i <= m; i++) {
    if ((a[i] ^ a[m + 1]).count() <= k) cnt++;
  }
  cout << cnt;
}
