#include <bits/stdc++.h>
using namespace std;
int a[200010], b[200010];
int main() {
  int n, m, k, ans = 0;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0, j = 0; i < n; b[a[i++]]--) {
    while (j < n && b[a[i]] + k >= j - i) b[a[j++]]++;
    if (ans < b[a[i]]) ans = b[a[i]];
  }
  cout << ans << endl;
  return 0;
}
