#include <bits/stdc++.h>
using namespace std;
const int MM = 2 * 100005;
int N, M, K, pre[MM], last[MM], cnt;
vector<int> v[100005];
int DP() {
  int Max = 0;
  for (int i = 1; i <= M; ++i) {
    int s = 0;
    for (int j = 0; j < v[i].size(); ++j) {
      while (v[i][j] - v[i][s] + 1 - (j - s + 1) > K) ++s;
      Max = max(Max, j - s + 1);
    }
  }
  return Max;
}
int main() {
  while (scanf("%d%d%d", &N, &M, &K) == 3) {
    int x;
    for (int i = 0; i <= M; ++i) v[i].clear();
    for (int i = 1; i <= N; ++i) {
      scanf("%d", &x);
      v[x].push_back(i);
    }
    printf("%d\n", DP());
  }
  return 0;
}
