#include <bits/stdc++.h>
using namespace std;
vector<int> a[100005];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  int i, c, ret = 0;
  for (i = 0; i < n; ++i) {
    scanf("%d", &c);
    a[c].push_back(i);
    int first = 0, cnt = (int)a[c].size(), last = cnt - 1, step, mid;
    while (cnt > 0) {
      step = cnt / 2;
      mid = first + step;
      int total = a[c][last] - a[c][mid] + 1, self = last - mid + 1;
      if (total - self > k) {
        first = mid + 1;
        cnt -= (step + 1);
      } else
        cnt = step;
    }
    ret = max(ret, last - first + 1);
  }
  cout << ret << endl;
  return 0;
}
