#include <bits/stdc++.h>
using namespace std;
int bit[1000005];
vector<int> v;
inline void update(int x, int val) {
  for (; x <= 1000000; x += (x & (-x))) bit[x] += val;
}
inline int query(int x) {
  if (x == 0) return 0;
  int vall = 0;
  for (; x >= 1; x -= (x & (-x))) vall += bit[x];
  return vall;
}
int main() {
  memset(bit, 0, sizeof bit);
  int n, m, k;
  cin >> n >> m >> k;
  int a, i;
  for (i = 0; i < n; i++) {
    cin >> a;
    v.push_back(a);
    update(a, 1);
  }
  int ans = 0;
  sort(v.begin(), v.end());
  for (i = m; i <= 1000000; i++) {
    int x = query(i) - query(i - m);
    if (i - m > v[n - 1]) break;
    if (x >= k) {
      int id = lower_bound(v.begin(), v.end(), i) - v.begin();
      if (id == n) id--;
      if (id < v.size() && v[id] > i) id--;
      while (x >= k) {
        ans++;
        x--;
        update(v[id], -1);
        id--;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
