#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int a[maxn], n, m, k;
struct node {
  int color, id;
} pp[maxn];
inline int max(int a, int b) { return a > b ? a : b; }
bool cmp(node a, node b) {
  return a.color < b.color || (a.color == b.color && a.id < b.id);
}
int find(int x) {
  int l = 1, r = n, mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (pp[mid].color > x)
      r = mid - 1;
    else
      l = mid + 1;
  }
  return r;
}
int main(int argc, char** argv) {
  while (~scanf("%d%d%d", &n, &m, &k)) {
    for (int i = 1; i <= n; ++i) scanf("%d", &pp[i].color), pp[i].id = i;
    sort(pp + 1, pp + n + 1, cmp);
    int maxx = 1;
    for (int i = 1; i <= n;) {
      int l = i, r = find(pp[i].color);
      int tmp = r - l + 1, cnt = 0;
      pp[l - 1].id = pp[l].id - 1;
      int ll = 0, rr = -1;
      for (int j = l; j <= r; ++j) {
        cnt += pp[j].id - pp[j - 1].id - 1;
        a[++rr] = j;
        if (cnt > k) {
          maxx = max(maxx, a[rr - 1] - a[ll] + 1);
          cnt -= pp[a[ll + 1]].id - pp[a[ll]].id - 1;
          ++ll;
        }
      }
      if (cnt <= k) maxx = max(maxx, a[rr] - a[ll] + 1);
      i += tmp;
    }
    cout << maxx << endl;
  }
  return (0);
}
