#include <bits/stdc++.h>
using namespace std;
int a[110];
int main() {
  int n, k;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> k;
  sort(a, a + n);
  int ans = 0, now = 1, j;
  for (int i = 0; i < n; i++) {
    now = 1;
    j = i;
    while (a[j + 1] - a[i] <= k && j + 1 < n) {
      j++;
      now++;
    }
    if (ans < now) ans = now;
  }
  cout << ans << endl;
  return 0;
}
