#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e6 + 5;
const long long inf = 1e10;
const long long mod = 1e9 + 7;
long long n, m, k;
long long a[maxN];
long long res = 0;
vector<long long> ve;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + 1 + n);
  if (k == 1) {
    cout << n;
    return 0;
  }
  long long cnt = 0;
  for (long long i = 1; i <= n; i++) {
    if (ve.size() >= (k - 1)) {
      long long tmp = ve[ve.size() - (k - 1)];
      if (a[i] - tmp >= m) {
        ve.push_back(a[i]);
      } else
        res++;
    } else {
      ve.push_back(a[i]);
    }
  }
  cout << res;
  return 0;
}
