#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<int> g[200010];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1, x; i <= n; i++) {
    scanf("%d", &x);
    g[x].push_back(i);
  }
  int ans = 0;
  for (int i = 1; i <= m; i++) {
    int x = 0, y = 0, len = g[i].size() - 1;
    while (y <= len) {
      if (g[i][y] - g[i][x] - (y - x) <= k) {
        ans = max(ans, y - x + 1);
        y++;
      } else
        x++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
