#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 2;
int n, m, k, a[maxn], ans = 0;
queue<int> q;
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a, a + n + 1);
  for (int i = 1; i <= n; i++) {
    while (!q.empty() && a[i] - q.front() >= m) q.pop();
    if (q.size() >= k - 1)
      ans++;
    else
      q.push(a[i]);
  }
  cout << ans;
}
