#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010, maxm = 2 * maxn;
int i, n, m, k, ans, a[maxm], sum[maxn];
int max(int x, int y) { return x > y ? x : y; }
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i <= n; ++i) scanf("%d", &a[i]);
  int head = 1, tail = 1;
  sum[a[head]] = 1;
  while (head <= n && tail <= n) {
    while (tail - head + 1 - sum[a[head]] <= k && tail < n)
      ++tail, ++sum[a[tail]];
    ans = max(ans, sum[a[head]]);
    --sum[a[head]];
    ++head;
  }
  printf("%d\n", ans);
  return 0;
}
