#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
bool Finish_read;
template <class T>
inline void read(T &x) {
  Finish_read = 0;
  x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    if (ch == EOF) return;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x *= f;
  Finish_read = 1;
}
template <class T>
inline void print(T x) {
  if (x / 10 != 0) print(x / 10);
  putchar(x % 10 + '0');
}
template <class T>
inline void writeln(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
  putchar('\n');
}
template <class T>
inline void write(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
}
int n, m, k, ans = 0, val[200010];
bool vis[200010];
int main() {
  read(n);
  read(m);
  read(k);
  for (int i = 1; i <= n; i++) read(val[i]);
  memset(vis, true, sizeof vis);
  vis[0] = 0;
  sort(val + 1, val + n + 1);
  int now = 0, have = 0;
  for (int i = 1; i <= n; i++) {
    have++;
    while (val[i] - m + 1 > val[now]) {
      if (vis[now]) have--;
      now++;
    }
    if (have >= k) {
      vis[i] = 0;
      ans++;
      have--;
    }
  }
  printf("%d\n", ans);
}
