#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
vector<int> co[maxn];
int n, m, k;
int mx;
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    co[a].push_back(i);
  }
  for (int i = 1; i <= m; i++) {
    int pointer1 = 0, pointer2 = 0, cnt = 0;
    while (pointer1 <= pointer2 && pointer2 < co[i].size()) {
      while (pointer2 < co[i].size() && cnt <= k) {
        pointer2++;
        cnt += (co[i][pointer2] - co[i][pointer2 - 1] - 1);
      }
      mx = max(mx, pointer2 - pointer1);
      pointer1++;
      cnt -= co[i][pointer1] - co[i][pointer1 - 1] - 1;
    }
  }
  cout << mx;
}
