#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const long long linf = 1e18 + 5;
const int M = 1e5 + 1;
int n, m, k, x, mx;
vector<int> v[M];
int main() {
  ios ::sync_with_stdio(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    v[x].push_back(i);
  }
  for (int i = 1; i <= M - 1; i++) {
    int b = 0, e = 0;
    while (b < v[i].size()) {
      while (e < v[i].size() and (v[i][e] - v[i][b] + 1) - (e - b + 1) <= k)
        e++;
      e--;
      mx = max(mx, e - b + 1);
      b++;
    }
  }
  cout << mx << '\n';
  return 0;
}
