#include <bits/stdc++.h>
#pragma GCC optimize("O3")
std::pair<int, int> DR[] = {{-1, 0}, {0, 1},   {1, 0}, {0, -1},
                            {-1, 1}, {-1, -1}, {1, 1}, {1, -1}};
using namespace std;
int n, m, k, a[1 << 18];
set<int> st;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  if (k == 1) {
    return cout << n, 0;
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    st.insert(i);
  }
  sort(a + 1, a + 1 + n);
  int l = 1;
  int r = k;
  while (r <= n) {
    while (r <= n && a[r] - a[l] + 1 <= m) {
      st.erase(r);
      r++;
    }
    auto it = st.find(l);
    it++;
    if (it == st.end())
      return cout << n - (int)((st).size()), 0;
    else
      l = *it;
    r++;
  }
  return cout << n - (int)((st).size()), 0;
}
