#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int a[N], b[N], n, m, k;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a + n);
  int ans = 0;
  for (int i = 0, j = 0; i < n; i++) {
    b[j] = a[i];
    if (i < k - 1 || b[j] - b[j - k + 1] >= m)
      j++;
    else
      ans++;
  }
  printf("%d\n", ans);
  return 0;
}
