#include <bits/stdc++.h>
using namespace std;
const int MAX = 200 * 1000;
vector<int> c[MAX + 10];
int a[MAX + 10];
int best = 1;
int n, m, k;
int bin_search(int, int, int, int);
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> a[i], c[a[i] - 1].push_back(i);
  for (int i = 0; i < m; i++)
    for (int j = 1; j < (int)c[i].size(); j++)
      best = max(best, j - bin_search(i, j, -1, j) + 1);
  cout << best << endl;
  return 0;
}
inline int check(int i, int s, int e) { return c[i][e] - c[i][s] - (e - s); }
int bin_search(int i, int j, int s, int e) {
  if (e <= s + 1) return e;
  int m = (s + e + 1) / 2;
  if (check(i, m, j) <= k)
    return bin_search(i, j, s, m);
  else
    return bin_search(i, j, m, e);
}
