#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 20;
int a[MAXN];
int main() {
  int n, k, m;
  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;
  queue<int> seq;
  for (int i = 0; i < n; ++i) {
    if (seq.size() + 1 < k) {
      seq.push(a[i]);
      while (a[i] - seq.front() + 1 > m) seq.pop();
    } else {
      int t = seq.empty() ? a[i] : seq.front();
      if (a[i] - t + 1 > m) {
        seq.push(a[i]);
        seq.pop();
      } else
        ans++;
    }
  }
  printf("%d\n", ans);
}
