#include <bits/stdc++.h>
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  int arr[1000002] = {0};
  int a;
  int i;
  int max = -1;
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    if (a > max) max = a;
    arr[a] = 1;
  }
  int count = 0;
  int l = 0, r = 0;
  int off = 0;
  for (r = 1; r <= m; r++) {
    if (arr[r] == 1) count++;
    if (count >= k) {
      arr[r] = 0;
      off++;
      count--;
    }
  }
  if (arr[1] == 1) count--;
  for (l = 2; r <= max; r++, l++) {
    if (arr[r] == 1) count++;
    if (count >= k) {
      arr[r] = 0;
      off++;
      count--;
    }
    if (arr[l] == 1) count--;
  }
  printf("%d\n", off);
  return 0;
}
