#include <bits/stdc++.h>
using namespace std;
const int N = int(2e5 + 5);
int n, m, k, a[N], cnt[N], res;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  int j = 0;
  cnt[a[0]] = 1;
  for (int i = 0; i < n; i++) {
    while (j - i + 1 <= cnt[a[i]] + k && j < n) {
      j++;
      res = max(res, cnt[a[i]]);
      if (j == n) {
        j--;
        break;
      }
      cnt[a[j]]++;
    }
    cnt[a[i]]--;
  }
  printf("%d\n", res);
  return 0;
}
