#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 11;
const int inf = 1e8;
int a[maxn];
int n, m, k;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int ans = 0;
  vector<int> vc(a, a + min(n, k - 1));
  for (int i = k - 1; i < n; i++) {
    vc.push_back(a[i]);
    int lst = (int)vc.size() - 1;
    if (vc[lst] - vc[lst - k + 1] < m) {
      ans++;
      vc.pop_back();
    }
  }
  cout << ans << endl;
}
