#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int *arr = new int[m + 1];
  for (int i = 0; i <= m; i++) {
    cin >> arr[i];
  }
  int ans = 0;
  for (int i = m - 1; i >= 0; i--) {
    int last = arr[m];
    int current = arr[i];
    int count = 0;
    bool flag = true;
    while (last != 0 || current != 0) {
      int bit1 = (last & 1);
      int bit2 = (current & 1);
      if ((bit1 ^ bit2) == 0) {
        last = (last >> 1);
        current = (current >> 1);
        continue;
      } else {
        count++;
        if (count > k) {
          flag = false;
          break;
        }
      }
      last = (last >> 1);
      current = (current >> 1);
    }
    if (flag == true) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
