#include <bits/stdc++.h>
using namespace std;
int n, i, j, m, k;
int a[2000000];
bool bo[2000000];
int l, r, ans, tot;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  int now = 0;
  bo[0] = true;
  for (i = 1; i <= n; i++) {
    tot++;
    while (a[i] - a[now] >= m && now <= n) tot -= (!bo[now]), now++;
    if (tot >= k) ans++, tot--, bo[i] = true;
  }
  printf("%d", ans);
  return 0;
}
