#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
class SegmentTree {
 private:
  int *data, *lazy;
  void pushup(int rt) { data[rt] = data[rt << 1] + data[rt << 1 | 1]; }
  void pushdown(int rt, int m) {
    if (lazy[rt] == 0) return;
    lazy[rt << 1] += lazy[rt];
    lazy[rt << 1 | 1] += lazy[rt];
    data[rt << 1] += (m - (m >> 1)) * lazy[rt];
    data[rt << 1 | 1] += (m >> 1) * lazy[rt];
    lazy[rt] = 0;
  }

 public:
  SegmentTree(int n)
      : data((int *)malloc((n << 2) * sizeof(int))),
        lazy((int *)malloc((n << 2) * sizeof(int))) {}
  void Build(int *base, int l, int r, int rt) {
    lazy[rt] = 0;
    if (l == r)
      data[rt] = base[l];
    else {
      int mid = (l + r) >> 1;
      Build(base, l, mid, rt << 1);
      Build(base, mid + 1, r, rt << 1 | 1);
      pushup(rt);
    }
  }
  void Modify(int l, int r, int rt, int L, int R, int v) {
    if (L <= l && R >= r) {
      lazy[rt] += v;
      data[rt] += v * (r - l + 1);
      return;
    }
    pushdown(rt, r - l + 1);
    int mid = (l + r) >> 1;
    if (L <= mid) Modify(l, mid, rt << 1, L, R, v);
    if (R > mid) Modify(mid + 1, r, rt << 1 | 1, L, R, v);
    pushup(rt);
  }
  int QueryPoint(int l, int r, int rt, int val) {
    if (l == r) return data[rt];
    pushdown(rt, r - l + 1);
    int mid = (l + r) >> 1;
    int ret = 0;
    if (val <= mid)
      ret = QueryPoint(l, mid, rt << 1, val);
    else
      ret = QueryPoint(mid + 1, r, rt << 1 | 1, val);
    pushup(rt);
    return ret;
  }
  int QuerySegment(int l, int r, int rt, int L, int R) {
    pushdown(rt, r - l + 1);
    if (L == l && R == r) return data[rt];
    int mid = (l + r) >> 1;
    if (R <= mid) return QuerySegment(l, mid, rt << 1, L, R);
    if (mid < L) return QuerySegment(mid + 1, r, rt << 1 | 1, L, R);
    return QuerySegment(l, mid, rt << 1, L, mid) +
           QuerySegment(mid + 1, r, rt << 1 | 1, mid + 1, R);
  }
};
int cmp(const void *x, const void *y) {
  int dx = *((int *)(x)), dy = *((int *)(y));
  return dx < dy ? -1 : 1;
}
int a[4000005], b[4000005];
SegmentTree st(4000005);
int main() {
  std::ios::sync_with_stdio(0), cin.tie(0);
  int n, m, k, x;
  cin >> n >> m >> k;
  memset(a, 0, sizeof(a));
  for (int i = 0; i < n; i++) {
    cin >> x;
    b[i] = x;
    a[x]++;
  }
  qsort(b, n, sizeof(int), cmp);
  st.Build(a, 1, 1000000, 1);
  int ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    int l, r;
    l = b[i];
    r = min(l + m - 1, 1000000);
    if (st.QuerySegment(1, 1000000, 1, l, r) >= k) {
      ans++;
      st.Modify(1, 1000000, 1, l, l, -1);
    }
  }
  cout << ans << endl;
  return 0;
}
