#include <bits/stdc++.h>
using namespace std;
int a[101];
int main() {
  int n, t, x = 1, num = 1;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a + n);
  scanf("%d", &t);
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++) {
      if (a[j] - a[i] <= t)
        x++;
      else {
        num = max(num, x), x = 1;
        break;
      }
      if (j == n - 1) i = n, num = max(num, x);
    }
  printf("%d", num);
  return 0;
}
