#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  priority_queue<int, vector<int>, greater<int>> q;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[i] = x;
  }
  sort(a.begin(), a.end());
  int ans = 0;
  for (int i = 0; i < n; i++) {
    while (!q.empty() && q.top() < a[i] - m + 1) {
      q.pop();
    }
    if (q.size() >= k - 1) {
      ans++;
    } else {
      q.push(a[i]);
    }
  }
  cout << ans;
  return 0;
}
