#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[200010], Oc[100010];
bool Can(int len) {
  int reallen = min(len + k, n);
  for (int i = 0; i < 100010; i++) Oc[i] = 0;
  for (int i = 0; i < reallen; i++) Oc[a[i]]++;
  for (int i = 0; i < n; i++) {
    if (Oc[a[i]] >= len) return 1;
    Oc[a[i]]--;
    if (i + reallen < n) Oc[a[i + reallen]]++;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  int lo = 1;
  int hi = n;
  while (hi - lo > 1) {
    int mid = (lo + hi) / 2;
    if (Can(mid) == false)
      hi = mid;
    else
      lo = mid;
  }
  if (Can(hi) == false && Can(lo) == true)
    cout << lo;
  else
    cout << hi;
  return 0;
}
