#include <bits/stdc++.h>
using namespace std;
const int N = int(2e5) + 200;
int n, m, k;
int x;
vector<int> v[N];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    v[x].push_back(i);
  }
  int res = 0, j;
  for (int x = 1; x <= m; x++) {
    j = 0;
    for (int i = 0; i < v[x].size(); i++) {
      for (; j < v[x].size(); j++) {
        if (v[x][j] - v[x][i] - j + i > k) break;
        res = max(res, j - i + 1);
      }
    }
  }
  cout << res;
  return 0;
}
