#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;
priority_queue<int, vector<int>, greater<int> > pq;
vector<int> v[100000];
int vec[200000];
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &vec[i]);
    v[--vec[i]].push_back(i);
  }
  int mav = 0;
  for (int c = 0; c < m; c++) {
    int l = 0;
    for (int i = 0; i < (int)(v[c]).size(); i++) {
      while (l < (int)(v[c]).size() && v[c][i] - v[c][l] - (i - l) > k) l++;
      mav = max(mav, i - l);
    }
  }
  printf("%d", mav + 1);
}
