#include <bits/stdc++.h>
using namespace std;
int c[200100];
vector<int> v[200100];
int n, m, k, ans = 0;
bool check(int l, int h, int a) {
  int cnt = upper_bound(v[a].begin(), v[a].end(), h) -
            lower_bound(v[a].begin(), v[a].end(), l);
  bool cur = (h - l + 1) - cnt <= k;
  if (cur) ans = max(ans, cnt);
  return cur;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    v[c[i]].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    int l = i, h = n - 1;
    while (l <= h) {
      int mid = (l + h) / 2;
      if (check(i, mid, c[i]))
        l = mid + 1;
      else
        h = mid - 1;
    }
  }
  cout << ans << endl;
  return 0;
}
