#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[200005], b[1000005], cnt, ans;
bool cmp(int a, int b) { return a < b; }
int main(void) {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n, cmp);
  int r = 0;
  for (int l = 0; l < n; l++) {
    while (a[r] - a[l] + 1 <= m && r < n) {
      if (b[a[l]]) break;
      if (!b[a[r]]) cnt++;
      if (cnt == k) {
        cnt--;
        ans++;
        b[a[r]] = 1;
      }
      r++;
    }
    if (l != r && !b[a[l]]) cnt--;
  }
  cout << ans << endl;
  return 0;
}
