#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int a[200000];
int br[100001];
bool check(int repetitions) {
  for (int i = 0; i <= 100000; i++) br[i] = 0;
  int window = repetitions + k;
  for (int i = 0; i < n; i++) {
    if (i - window >= 0) br[a[i - window]]--;
    br[a[i]]++;
    if (br[a[i]] == repetitions) return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  int left = 1, right = n;
  while (left <= right) {
    int middle = (left + right) / 2;
    if (check(middle))
      left = middle + 1;
    else
      right = middle - 1;
  }
  cout << right << endl;
  return 0;
}
