#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  m--;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int now = 0, j = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] != -1) {
      while (j < n && a[j] - a[i] <= m) {
        now++;
        if (k <= now) {
          now--, a[j] = -1, ans++;
        }
        j++;
      }
      if (a[i] != -1) now--;
    }
  }
  cout << ans;
  return 0;
}
