#include <bits/stdc++.h>
using namespace std;
int arr[200010];
vector<int> places[100010];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    places[arr[i]].push_back(i);
  }
  int answer = 0;
  int i = 1;
  while (i <= m) {
    int j = 0;
    for (int kj = 0; kj < places[i].size(); kj++) {
      while (j < places[i].size() &&
             (places[i][j] - places[i][kj]) - (j - kj) <= k)
        j++;
      answer = max(answer, j - kj);
    }
    i++;
  }
  cout << answer << endl;
}
