#include <bits/stdc++.h>
using namespace std;
struct node {
  int cnt, dis;
};
vector<node> num[200005];
int m, A[200005], bef[200005], K, sum[200005];
bool check(int s) {
  int i, j;
  for (i = 1; i <= m; i++) {
    if (sum[i] < s) continue;
    int cnt = 0, dis = 0, L = 0;
    for (j = 0; j < num[i].size(); j++) {
      cnt += num[i][j].cnt;
      while (dis > K) {
        dis -= num[i][L].dis;
        cnt -= num[i][L].cnt;
        L++;
      }
      dis += num[i][j].dis;
      if (cnt >= s) return true;
    }
  }
  return false;
}
int main() {
  int n, i, j, k;
  while (scanf("%d %d %d", &n, &m, &K) != EOF) {
    for (i = 1; i <= m; i++) {
      bef[i] = 0;
      num[i].clear();
      sum[i] = 0;
    }
    for (i = 1; i <= n; i++) scanf("%d", &A[i]);
    node temp;
    int L = 1, R = n;
    for (i = 1; i <= n; i++) {
      int x = A[i];
      if (!bef[x]) {
        temp.cnt = 1, temp.dis = 0;
        num[x].push_back(temp);
      } else {
        if (i == bef[x] + 1) {
          num[x][num[x].size() - 1].cnt++;
          int t = num[x][num[x].size() - 1].cnt;
          if (t > L) L = t;
        } else {
          num[x][num[x].size() - 1].dis = i - bef[x] - 1;
          temp.cnt = 1, temp.dis = 0;
          num[x].push_back(temp);
        }
      }
      bef[x] = i;
      sum[x]++;
    }
    int res = L++;
    while (L <= R) {
      int mid = (L + R) >> 1;
      if (check(mid)) {
        res = mid, L = mid + 1;
      } else
        R = mid - 1;
    }
    printf("%d\n", res);
  }
  return 0;
}
