#include <bits/stdc++.h>
int a[200009];
int visit[200009];
int swap(int l, int r) {
  int tmp = a[r];
  a[r] = a[l];
  a[l] = tmp;
}
int qsort(int left, int right) {
  if (left >= right) return 0;
  int l = left, r = right, x = a[l];
  while (l < r) {
    while (l < r && a[l] < x) l++;
    while (l < r && a[r] > x) r--;
    if (l < r) {
      if (a[l] > a[r])
        swap(l, r);
      else
        l++;
    }
  }
  qsort(left, l - 1);
  qsort(l + 1, right);
}
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  qsort(1, n);
  memset(visit, 0, sizeof(visit));
  int ans = 0;
  int l = 1;
  for (int r = k; r <= n; r++) {
    if (a[r] - a[l] < m) {
      ans++;
      visit[r] = 1;
    } else {
      while (visit[l + 1] == 1) {
        l++;
      }
      l++;
    }
  }
  if (k == 1)
    printf("%d\n", n);
  else
    printf("%d\n", ans);
}
