#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cout << '\n'; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << '[' << *it << " = " << a << "]  ";
  err(++it, args...);
}
mt19937 rng(
    (unsigned int)chrono::steady_clock::now().time_since_epoch().count());
int rnd(int a, int b) { return a + (rng() % (b - a + 1)); }
const long long int M = 1000000007ll;
const double D = 1.0;
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end());
  set<int> s;
  int x, ans = 0;
  for (int i = 0; i < n; ++i) {
    x = a[i];
    while (!s.empty() and x - m + 1 > (*s.begin())) {
      s.erase(s.begin());
    }
    if (s.size() < k - 1)
      s.insert(x);
    else
      ans++;
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc = 1;
  while (tc--) {
    solve();
  }
  return 0;
}
