#include <bits/stdc++.h>
using namespace std;
int alarm[200005];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &alarm[i]);
  }
  sort(alarm, alarm + n);
  bool off[200005] = {};
  int now = 1;
  int on = 1;
  for (int i = 0; i < n; i++) {
    if (off[i]) continue;
    while (alarm[now] - alarm[i] < m && now < n) {
      now++;
      on++;
    }
    int turn = now - 1;
    while (on >= k) {
      if (off[turn] == 0) {
        off[turn] = 1;
        on--;
      }
      turn--;
    }
    if (off[i] == 0) {
      on--;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (off[i]) {
      ans++;
    }
  }
  printf("%d", ans);
}
