#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100001;
int n, m, k;
vector<int> cube[MAX_N];
int siz[MAX_N];
void solve() {
  for (int i = 1; i <= m; ++i) {
    siz[i] = cube[i].size();
  }
  int ret = 0;
  for (int i = 1; i <= m; ++i) {
    int s = 0, t = 0;
    while (t < siz[i]) {
      int cal = cube[i][t] - cube[i][s] - (t - s);
      if (cal > k) {
        ++s;
        continue;
      }
      ret = max(ret, t - s + 1);
      ++t;
    }
  }
  printf("%d\n", ret);
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; ++i) {
    int val;
    scanf("%d", &val);
    cube[val].push_back(i);
  }
  solve();
  return 0;
}
