#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a + n);
  int sum = 0;
  for (int i = 0, j = k - 1; j < n; j++) {
    if (a[j] + 1 - a[i] <= m) {
      a[j] = -1;
      sum++;
      if (i == j) i++;
    } else {
      i++;
      while (a[i] == -1) i++;
    }
  }
  cout << sum << endl;
}
