#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000001;
template <class T, class U>
bool remax(T &a, const U &b) {
  return a < b ? (a = b, 1) : 0;
}
int main() {
  int n, m, k, x;
  (scanf("%d %d %d", &(n), &(m), &(k)) == 3);
  vector<vector<int> > V(m + 1);
  for (int i = (1); i <= (n); ++i) {
    (scanf("%d", &(x)) == 1);
    V[x].push_back(i);
  }
  int best = 1;
  for (typeof((V).begin()) v = ((V).begin()); v != (V).end(); ++v) {
    int p, f = 1;
    int a = 0;
    int uk = 0;
    deque<int> d;
    deque<int> A;
    for (typeof((*v).begin()) i = ((*v).begin()); i != (*v).end(); ++i) {
      if (f) {
        f = 0;
        a = 1;
        A.push_back(1);
        p = *i;
        continue;
      }
      if (p + 1 == *i) {
        ++A.back();
        remax(best, ++a);
      } else {
        d.push_back(*i - (p + 1));
        uk += d.back();
        while (uk > k) {
          uk -= d.front();
          a -= A.front();
          d.pop_front();
          A.pop_front();
        }
        A.push_back(1);
        remax(best, ++a);
      }
      p = *i;
    }
  }
  printf("%d\n", best);
}
