#include <bits/stdc++.h>
using namespace std;
int n, m, k, c[200005];
vector<int> seq[100005];
int main() {
  int max = 1;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &c[i]);
    seq[c[i] - 1].push_back(i);
  }
  for (int i = 0; i < m; ++i) {
    int st, end, sep = 0;
    if (seq[i].size())
      st = end = 0;
    else
      continue;
    while (end < seq[i].size() - 1) {
      ++end;
      sep += seq[i][end] - seq[i][end - 1] - 1;
      while (sep > k) {
        ++st;
        sep -= seq[i][st] - seq[i][st - 1] - 1;
      }
      max = (max > end - st + 1 ? max : end - st + 1);
    }
  }
  printf("%d", max);
}
