#include <bits/stdc++.h>
using namespace std;
int ap[100010];
vector<int> s[100010];
int main() {
  int n, m, k, i, j, t, ans;
  scanf("%d %d %d", &n, &m, &k);
  fill(ap + 1, ap + m + 1, 0);
  for (i = 1; i <= m; i++) s[i].push_back(0);
  for (i = 1; i <= n; i++) {
    scanf("%d", &t);
    if (ap[t]) s[t].push_back(i - ap[t] - 1);
    ap[t] = i;
  }
  for (i = 1; i <= m; i++)
    for (j = 1; j < s[i].size(); j++) s[i][j] += s[i][j - 1];
  ans = 1;
  for (i = 1; i <= m; i++)
    for (j = s[i].size() - 1; j >= ans; j--)
      while (j >= ans && s[i][j] - s[i][j - ans] <= k) ans++;
  printf("%d\n", ans);
}
