#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5 + 4;
int a[N], v[N], s[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    v[i] = 1;
  }
  sort(a, a + n);
  int j = 0;
  int res = 0;
  int cur = 0;
  for (int i = 0; i < n; i++) {
    while (j < n && a[j] - a[i] < m) {
      cur += v[j];
      s[j] = cur;
      if (cur >= k && v[j] == 1) {
        v[j] = 0;
        res++;
        cur--;
      }
      j++;
    }
    if (v[i]) cur--;
  }
  cout << res << '\n';
  return 0;
}
