#include <bits/stdc++.h>
using namespace std;
int n, t, T, ma, m, j;
int main() {
  cin >> n;
  vector<int> s(n);
  if (n == 1) {
    cout << 1;
    return 0;
  }
  for (int i = 0; i < n; i++) cin >> s[i];
  cin >> t;
  T = t;
  ma = 1;
  m = 0;
  sort(s.begin(), s.end());
  for (int i = 1; i < n; i++) {
    j = i;
    while (s[j] - s[j - 1] <= t && j < n) {
      t -= s[j] - s[j - 1];
      ma++;
      j++;
    }
    m = max(m, ma);
    ma = 1;
    t = T;
  }
  cout << m;
  return 0;
}
