#include <bits/stdc++.h>
using namespace std;
long long int BIT[1000006];
void update(int x, int val) {
  for (; x <= 1000000; x += x & -x) BIT[x] += val;
}
long long int query(int x) {
  int sum = 0;
  for (; x > 0; x -= x & -x) sum += BIT[x];
  return sum;
}
int main() {
  long long int n, k, m, i, check, temp, ans = 0, num, z;
  long long int has[1000006] = {};
  set<int> s;
  set<int>::iterator it;
  cin >> n >> m >> k;
  for (i = 0; i < n; i++) {
    scanf("%I64d", &num);
    s.insert(num);
    update(num, 1);
    has[num] = 1;
  }
  for (i = 0; i <= 1000000 - m; i++) {
    check = query(i + m) - query(i);
    if (check >= k) {
      temp = i + m;
      while (check >= k) {
        if (has[temp] == 1) {
          has[temp] = 0;
          s.erase(temp);
          update(temp, -1);
        } else {
          it = s.lower_bound(temp);
          it--;
          z = *it;
          s.erase(z);
          update(z, -1);
        }
        ans++;
        check--;
      }
    }
  }
  cout << ans;
  return 0;
}
