#include <bits/stdc++.h>
using namespace std;
vector<int> a(1000001, 0);
int main() {
  ios_base::sync_with_stdio(false);
  int n, k, m, x, count = 0, ans = 0, i;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a[x]++;
  }
  for (i = 1; i <= m; i++) {
    count += a[i];
    if (count == k) {
      count--;
      a[i]--;
      ans++;
    }
  }
  for (i = m + 1; i < 1000001; i++) {
    count += a[i] - a[i - m];
    if (count == k) {
      count--;
      a[i]--;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
