#include <bits/stdc++.h>
using namespace std;
int n, m, k, s[200005];
list<int> L[100005];
int cnt[100005];
bool ok(int sco) {
  memset(cnt, 0, sizeof(cnt));
  for (int i = 1; i <= m; i++) L[i].clear();
  for (int i = 1; i <= n; i++) {
    L[s[i]].push_back(i);
    cnt[s[i]]++;
    if (cnt[s[i]] == sco) {
      if (i - L[s[i]].front() + 1 - sco <= k) return true;
      cnt[s[i]]--;
      L[s[i]].pop_front();
    }
  }
  return false;
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &s[i]);
  int lt = 1, rt = n + 1;
  while (rt - lt > 1) {
    int md = (lt + rt) >> 1;
    if (ok(md))
      lt = md;
    else
      rt = md;
  }
  printf("%d\n", lt);
  return 0;
}
