#include <bits/stdc++.h>
using namespace std;
template <class T>
int size(const T &x) {
  return x.size();
}
const int INF = ~(1 << 31);
const double EPS = 1e-9;
const double pi = acos(-1);
template <class T>
T smod(T a, T b) {
  return (a % b + b) % b;
}
int main() {
  cin.sync_with_stdio(false);
  int n, m, k, x;
  cin >> n >> m >> k;
  vector<pair<int, int> > event;
  for (__typeof(0) i = (0); i < (n); ++i) {
    cin >> x;
    event.push_back(pair<int, int>(x, 1));
    event.push_back(pair<int, int>(x + m, 0));
  }
  int cnt = 0;
  set<int> shut_off;
  int ans = 0;
  sort(event.begin(), event.end());
  for (__typeof(0) i = (0); i < (size(event)); ++i) {
    if (event[i].second == 1) {
      if (cnt + 1 == k) {
        shut_off.insert(event[i].first + m);
        ans++;
      } else
        cnt++;
    } else {
      if (shut_off.find(event[i].first) == shut_off.end()) cnt--;
    }
  }
  cout << ans << endl;
  return 0;
}
