#include <bits/stdc++.h>
using namespace std;
long long int n, m, k;
long long int a[200005];
bool check(long long int mid) {
  map<long long int, long long int> count;
  long long int ans = 0;
  for (int i = 1; i <= min(n, mid + k); i++) {
    count[a[i]]++;
    ans = max(ans, count[a[i]]);
  }
  int j = 1;
  for (int i = min(mid + k, n) + 1; i <= n; i++) {
    count[a[j]]--;
    count[a[i]]++;
    ans = max(ans, count[a[i]]);
    j++;
  }
  return ans >= mid;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long int lo = 1, hi = n;
  long long int ans = 0;
  while (lo <= hi) {
    long long int mid = (lo + hi) / 2;
    if (check(mid)) {
      ans = max(ans, mid);
      lo = mid + 1;
    } else {
      hi = mid - 1;
    }
  }
  cout << ans << endl;
}
