#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
int N, M, K;
int A[MAXN];
bool off[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin >> N >> M >> K;
  for (int i = 0; i < N; i++) cin >> A[i];
  sort(A, A + N);
  if (K == 1) {
    cout << N << "\n";
    return 0;
  }
  int ans = 0;
  for (int i = 0, right = i, cnt = 0; i < N; i++) {
    if (off[i]) continue;
    while (right < N && A[right] < A[i] + M) {
      if (cnt + 1 == K) {
        off[right] = true;
        ans++;
      } else
        cnt++;
      right++;
    }
    cnt--;
  }
  cout << ans << "\n";
  return 0;
}
