#include <bits/stdc++.h>
using namespace std;
const long long MX = 1e6 + 2;
bool hayAlarma[MX];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  for (long long i = 0; i < (long long)n; i++) {
    int a;
    cin >> a;
    hayAlarma[a] = true;
  }
  int f = 0, cont = 0, elimino = 0;
  for (f = 0; f <= m; f++) {
    if (hayAlarma[f]) {
      cont++;
    }
    if (cont == k) {
      hayAlarma[f] = false;
      elimino++;
      cont--;
    }
  }
  int i = 1;
  for (f = m + 1; f < 1000001; f++, i++) {
    if (hayAlarma[f]) {
      cont++;
    }
    if (hayAlarma[i]) {
      cont--;
    }
    if (cont >= k) {
      hayAlarma[f] = false;
      cont--;
      elimino++;
    }
  }
  cout << elimino << endl;
}
