#include <bits/stdc++.h>
using namespace std;
int n, m, k, a, cnt[1000009];
int stk[1000009], ptr;
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    cnt[a]++;
  }
  ptr = 0;
  int ans = 0;
  for (int i = 1; i <= m; i++) {
    if (cnt[i] == 0) continue;
    for (int j = 1; j <= cnt[i]; j++) stk[++ptr] = i;
  }
  while (ptr >= k) {
    cnt[stk[ptr]]--;
    ptr--;
    ans++;
  }
  int now = ptr;
  for (int i = m + 1; i <= 1000001; i++) {
    now -= cnt[i - m];
    if (cnt[i] == 0) continue;
    for (int j = 1; j <= cnt[i]; j++) {
      stk[++ptr] = i;
      now++;
    }
    while (now >= k) {
      now--;
      cnt[stk[ptr]]--;
      ptr--;
      ans++;
    }
  }
  printf("%d\n", ans);
}
