#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int a[maxn], cnt[maxn];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int l = 1, r = 1;
  int ans = 0;
  cnt[a[1]]++;
  while (l <= n) {
    if (((r - l + 1) - cnt[a[l]]) <= k) {
      ans = max(ans, cnt[a[l]]);
      if (r < n) {
        r++;
        cnt[a[r]]++;
      } else {
        cnt[a[l]]--;
        l++;
      }
    } else {
      cnt[a[l]]--;
      l++;
    }
  }
  cout << ans << endl;
  return 0;
}
