#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
long long mod = 1000000007LL;
long long mod2 = 998244353LL;
int n, m, k;
bool a[1000005];
int main() {
  cin >> n >> m >> k;
  memset(a, false, sizeof(a));
  for (int i = 1; i <= n; ++i) {
    int ai;
    scanf("%d", &ai);
    a[ai] = true;
  }
  int ans = 0;
  deque<int> dq;
  for (int i = 1; i <= 1000001; ++i) {
    if (a[i]) {
      dq.push_back(i);
    }
    while (!dq.empty() && i - dq.front() >= m) {
      dq.pop_front();
    }
    if (i >= m) {
      int det = dq.size() - (k - 1);
      if (det > 0) {
        for (int j = 1; j <= det; ++j) {
          dq.pop_back();
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
