#include <bits/stdc++.h>
using namespace std;
string x;
set<int> alarm;
int n, m, k, a[200005], b[200005], now = 0, ans = 0;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + n + 1);
  for (int i = 1, j = 1; i <= n; i++) {
    b[j] = a[i];
    if (i < k || b[j] - b[j - k + 1] >= m)
      j++;
    else
      ans++;
  }
  printf("%d", ans);
}
