#include <bits/stdc++.h>
using namespace std;
int G = 1000000;
int n, t[1300000], m, k, a[2 * 111111], id[1300000];
int getP(int a) { return a - (a & (-a)); }
int getN(int a) { return a + (a & (-a)); }
void upd(int x, int vl) {
  for (int i = x; i <= G; i = getN(i)) {
    t[i] += vl;
  }
}
int get(int x) {
  int res = 0;
  for (int i = x; i >= 1; i = getP(i)) res += t[i];
  return res;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    upd(a[i], 1);
    id[a[i]] = 1;
    G = max(G, a[i]);
  }
  G += 10;
  int i = 1, ans = 0;
  while (1) {
    if (i >= G) break;
    if (id[i] == 0) {
      i++;
      continue;
    }
    int sm = get(min(G, i + m - 1)) - get(i - 1);
    if (sm >= k) {
      int cnt = 0;
      for (int j = min(G, i + m - 1); j >= i; j--) {
        if (sm - cnt < k) break;
        if (id[j] == 1) {
          id[j] = 0;
          cnt++;
          upd(j, -1);
        }
      }
      ans += cnt;
    }
    i++;
  }
  cout << ans;
  return 0;
}
