#include <bits/stdc++.h>
using namespace std;
int last[200010];
int a[200010];
int nxt[200010];
int vis[200010];
int main() {
  ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(20);
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = (1); i <= (n); ++i) scanf("%d", a + i);
  memset(last, -1, sizeof(last));
  for (int i = (n); i >= (1); --i) {
    nxt[i] = last[a[i]];
    last[a[i]] = i;
  }
  int ans = 0;
  for (int i = (1); i <= (n); ++i)
    if (!vis[a[i]]) {
      int tmp = 1;
      int cost = 0;
      vis[a[i]] = 1;
      int l = i, r = i;
      while (r != -1) {
        while (cost > k) {
          cost -= nxt[l] - l - 1;
          l = nxt[l];
          tmp--;
        }
        ans = (tmp > ans ? tmp : ans);
        cost += nxt[r] - r - 1;
        r = nxt[r];
        tmp++;
      }
    }
  printf("%d\n", ans);
  return 0;
}
