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