#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int MAXN = 1e6 + 10;
int n, m, k, a[MAXN], t[MAXN];
void upd(int i, int val) {
  a[i] += val;
  for (; i < MAXN; i |= (i + 1)) {
    t[i] += val;
  }
}
int get(int r) {
  int total = 0;
  for (; r >= 0; r = (r & (r + 1)) - 1) {
    total += t[r];
  }
  return total;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) {
    int p;
    scanf("%d", &p);
    upd(p, 1);
  }
  int ans = 0;
  for (int i = 0; i + m < MAXN; i++) {
    int r = i + m;
    while (get(i + m) - get(i) >= k) {
      while (a[r] == 0) r--;
      upd(r, -1);
      ans++;
    }
  }
  cout << ans;
}
