#include <bits/stdc++.h>
using namespace std;
const int MAXM = 100005;
vector<int> pos[MAXM];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    pos[x].push_back(i);
  }
  int ans = 0;
  for (int i = 1; i <= m; ++i) {
    for (int l = 0, r = 0; r < pos[i].size(); ++l) {
      while (r < pos[i].size() && pos[i][r] - pos[i][l] + 1 - (r - l + 1) <= k)
        r++;
      r = max(r - 1, l);
      ans = max(ans, r - l + 1);
    }
  }
  printf("%d\n", ans);
  return 0;
}
