#include <bits/stdc++.h>
using namespace std;
int n, a, b, m, k, l = 0, r, otv, bud;
int c[300000];
bool yes[300000];
int main() {
  ::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  sort(c, c + n);
  for (int i = 0; i < n; i++) {
    bud++;
    while (c[l] + m <= c[i]) {
      if (!yes[l]) bud--;
      l++;
    }
    if (bud >= k) {
      yes[i] = 1;
      otv++;
      bud--;
    }
  }
  cout << otv;
}
