#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<int> v[100005];
int calc(vector<int> &v) {
  int s, t, ans = 0;
  for (s = t = 0; t < ((int)(v).size()); t++) {
    while (s <= t && v[t] - v[s] - t + s > k) s++;
    ans = max(ans, t - s + 1);
  }
  return ans;
}
int main() {
  int i, x, ans;
  while (scanf("%d %d %d", &n, &m, &k) != EOF) {
    ans = 0;
    for (i = 1; i <= m; i++) (v[i]).clear();
    for (i = 1; i <= n; i++) {
      scanf("%d", &x);
      v[x].push_back(i);
    }
    for (i = 1; i <= m; i++) ans = max(ans, calc(v[i]));
    printf("%d\n", ans);
  }
  return 0;
}
