#include <bits/stdc++.h>
using namespace std;
vector<int> e[100010];
int main() {
  int n, m, k, x;
  while (scanf("%d%d%d", &n, &m, &k) == 3) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &x);
      e[x].push_back(i);
    }
    int ans = 1;
    for (int i = 1; i <= m; i++) {
      int j = 0;
      for (int p = 0; p < e[i].size(); p++) {
        while ((e[i][p] - e[i][j] + 1) - (p - j + 1) > k) j++;
        ans = max(ans, p - j + 1);
      }
    }
    printf("%d\n", ans);
  }
}
