#include <bits/stdc++.h>
using namespace std;
vector<int> data[100010];
int f[200010];
int ans = 0;
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1, a; i <= n; i++) scanf("%d", &a), data[a].push_back(i);
  for (int i = 1; i <= m; i++) {
    if (data[i].size() <= ans) continue;
    int head = 1, last = 0, sum = 0;
    for (int j = 1; j < data[i].size(); j++) {
      f[++last] = data[i][j] - data[i][j - 1] - 1;
      sum += f[last];
      while (sum > k) sum -= f[head++];
      ans = max(ans, last - head + 1);
    }
  }
  printf("%d", ans + 1);
  return 0;
}
