#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[1000006];
int main() {
  int i, j;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &k);
  for (i = 1; i <= n; i++) {
    scanf("%d", &j);
    a[j] = 1;
  }
  if (m < k) return cout << 0 << endl, 0;
  int ans = 0, cnt = 0;
  for (i = 1; i <= m; i++) {
    if (a[i]) {
      if (cnt == k - 1) {
        a[i] = 0;
        ans++;
      } else
        cnt++;
    }
  }
  j = 1;
  for (; i <= 1000006 - 5; i++) {
    if (a[j]) cnt--;
    j++;
    if (a[i]) {
      if (cnt == k - 1) {
        a[i] = 0;
        ans++;
      } else
        cnt++;
    }
  }
  cout << ans << endl;
  return 0;
}
