#include <bits/stdc++.h>
using namespace std;
long long int tree[8000000], lim;
vector<long long int> ar;
bool vis[200200];
inline void update(long long int nd, long long int s, long long int e,
                   long long int idx, long long int val) {
  if (s == e) {
    tree[nd] = val;
    return;
  }
  long long int m = (s + e) / 2;
  if (idx <= m)
    update(2 * nd + 1, s, m, idx, val);
  else
    update(2 * nd + 2, m + 1, e, idx, val);
  tree[nd] = tree[2 * nd + 1] + tree[2 * nd + 2];
}
inline long long int query(long long int nd, long long int s, long long int e,
                           long long int l, long long int r) {
  if (r < l || r < s || e < l) return 0;
  if (l <= s && e <= r) return tree[nd];
  long long int m = (s + e) / 2;
  long long int ans =
      query(2 * nd + 1, s, m, l, r) + query(2 * nd + 2, m + 1, e, l, r);
  return ans;
}
int main() {
  memset(tree, 0, sizeof(tree));
  memset(vis, true, sizeof(vis));
  long long int n, m, k, ans = 0;
  cin >> n >> m >> k;
  ar.resize(n);
  for (long long int i = 0; i < n; i++) cin >> ar[i];
  sort(ar.begin(), ar.end());
  lim = max(ar[n - 1] + 10, m + 10);
  for (long long int i = 0; i < n; i++) update(0, 0, lim, ar[i], 1);
  for (long long int i = 1; i <= lim; i++) {
    long long int L = i, R = i + m - 1;
    if (R >= lim) break;
    long long int ctr = query(0, 0, lim, L, R);
    if (ctr >= k) {
      ans += ctr - k + 1;
      ctr = ctr - k + 1;
      long long int where =
          upper_bound(ar.begin(), ar.end(), R) - ar.begin() - 1;
      while (ctr > 0) {
        if (vis[where]) {
          vis[where] = false;
          update(0, 0, lim, ar[where], 0);
        }
        ctr--;
        where--;
      }
    }
  }
  cout << ans;
  return 0;
}
