#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) return power(a * a % 1000000007, b / 2) % 1000000007;
  return a * power(a, b - 1) % 1000000007;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int b[200000];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(begin(a), end(a));
  int ans = 0;
  int counter = 0;
  int l = 0, r = 0;
  while (r < n) {
    while (a[l] + m <= a[r]) {
      counter -= b[l] ^ 1;
      l++;
    }
    counter++;
    if (counter >= k) {
      counter--;
      b[r] = 1;
      ans++;
    }
    r++;
  }
  cout << ans;
  return 0;
}
