#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int a[maxn];
vector<int> vc[maxn];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    vc[a[i]].push_back(i);
  }
  int ans = 0;
  for (int i = 1; i <= m; ++i) {
    int now = 0, l = 0, r = 0, up = vc[i].size();
    for (; l < up;) {
      while (now + vc[i][r + 1] - vc[i][r] - 1 <= k && r < up - 1) {
        now += vc[i][r + 1] - vc[i][r] - 1;
        ++r;
      }
      ans = max(ans, r - l + 1);
      now -= vc[i][l + 1] - vc[i][l] - 1;
      ++l;
    }
  }
  cout << ans << endl;
  return 0;
}
