#include <bits/stdc++.h>
using namespace std;
int a, n;
const int mx_n = 1e3;
int v[mx_n];
bool f(int x) {
  for (int i = 0; i < n - x; ++i) {
    if (v[i + x] - v[i] <= a) return true;
  }
  return false;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  cin >> a;
  sort(v, v + n);
  int l = 0, r = n;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (f(m)) {
      l = m;
    } else {
      r = m;
    }
  }
  cout << r;
}
