#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long t = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    c = getchar();
  }
  while (c >= '0' && c <= '9') t = t * 10 + c - 48, c = getchar();
  return t * f;
}
const int N = 200005;
int ans, sum, n, m, k, a[N], vis[N];
int main() {
  n = read();
  m = read();
  k = read();
  for (long long i = 1; i <= n; ++i) {
    a[i] = read();
    vis[i] = 1;
  }
  sort(&a[1], &a[n + 1]);
  int l = 0;
  for (long long i = 1; i <= n; ++i) {
    sum++;
    while (a[l] < a[i] - m + 1) sum -= vis[l++];
    if (sum >= k) {
      vis[i] = 0;
      ans++;
      sum--;
    }
  }
  cout << ans << endl;
}
