#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[1000010], pre[1000010];
int fd(int x) {
  if (pre[x] == -1) return -1;
  if (a[x])
    return x;
  else
    return pre[x] = fd(pre[x]);
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  int mx = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    mx = max(mx, x);
    ++a[x];
  }
  m = min(m, mx);
  int sum = 0, ans = 0;
  for (int i = 1; i <= m; ++i) sum += a[i];
  for (int i = 1; i <= mx - m + 1; ++i) {
    int j = i + m - 1;
    while (j >= i && sum >= k) {
      int diff = min(a[j], sum - k + 1);
      ans += diff;
      a[j] -= diff;
      sum -= diff;
      --j;
    }
    sum = sum - a[i] + a[i + m];
  }
  printf("%d\n", ans);
  return 0;
}
