#include <bits/stdc++.h>
using namespace std;
int a[1100];
int main(void) {
  int n, T;
  while (cin >> n) {
    for (int i = 0; i < n; ++i) cin >> a[i];
    cin >> T;
    sort(a, a + n);
    for (int i = 0; i < n - 1; ++i) a[i] = a[i + 1] - a[i];
    int sum = 0;
    int front = 0;
    int max = 1;
    int count = 1;
    for (int i = 0; i < n - 1; ++i) {
      sum += a[i];
      count++;
      if (sum <= T) {
        if (count > max) max = count;
      } else {
        while (sum > T) {
          if (count > 1) count--;
          sum -= a[front];
          front++;
        }
      }
    }
    cout << max << endl;
  }
  return 0;
}
