#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int oo = 1e9 + 10;
const int mod = 1e9 + 7;
const int N = 1e6;
void solve() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  vector<int> v(n);
  for (int i = 0; i < n; i++) scanf("%d", &v[i]);
  sort((v).begin(), (v).end());
  deque<int> dq;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    dq.push_back(v[i]);
    while (!dq.empty() && dq.front() <= (v[i] - m)) dq.pop_front();
    if (dq.size() == k) {
      ans++;
      dq.pop_back();
    }
  }
  printf("%d\n", ans);
}
int t;
int main() { solve(); }
