#include <bits/stdc++.h>
using namespace std;
const long long inf = (1ll << 60);
const long long mod = 1e9 + 7;
const int MX = 1e6 + 9;
const int SQ = 300;
int n, m, k, a[MX], l[MX], x;
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  int last = -1;
  for (int i = 0; i < MX; i++) {
    if (a[i]) {
      l[i] = last;
      last = i;
    }
  }
  int sum = 0, ans = 0;
  for (int i = 1; i <= m; i++) {
    sum += a[i];
    if (sum >= k) {
      if (a[i]) {
        a[i] = 0;
        sum--;
        ans++;
      }
    }
  }
  int p1 = 1, p2 = m + 1;
  while (p2 < MX) {
    sum -= a[p1];
    sum += a[p2];
    if (sum == k) {
      a[p2] = 0;
      ans++;
      sum--;
    }
    p1++;
    p2++;
  }
  cout << ans << endl;
}
