#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
const long long N = 1e6;
long long a[N];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(20);
  cin >> n >> m >> k;
  for (long long i = 0; i < n; ++i) {
    long long val;
    cin >> val;
    ++a[--val];
  }
  long long ans = 0, cnt = 0;
  for (long long i = 0; i < m; ++i) {
    if (cnt + a[i] == k) {
      --a[i];
      ++ans;
    }
    cnt += a[i];
  }
  for (long long i = m; i < N; ++i) {
    cnt -= a[i - m];
    if (cnt + a[i] == k) {
      --a[i];
      ++ans;
    }
    cnt += a[i];
  }
  cout << ans;
}
