#include <bits/stdc++.h>
using namespace std;
int a[105];
int cha[104];
int n, T;
int check(int k) {
  int i;
  for (i = 0; i < n - k + 1; i++) {
    if (abs(a[i] - a[i + k - 1]) <= T) return 1;
  }
  return 0;
}
int main() {
  int i;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n);
  scanf("%d", &T);
  int l = 1;
  int r = n;
  while (l < r) {
    int mid = (l + r + 1) / 2;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  cout << l << endl;
  return 0;
}
