#include <bits/stdc++.h>
using namespace std;
long long int n, m, k;
const long long int N = 1e5 + 5;
vector<long long int> a[N];
long long int arr[N * 2];
long long int check(long long int x) {
  long long int l = 0;
  long long int ans = 0;
  for (long long int r = 0; r < a[x].size(); r++) {
    while (a[x][r] - a[x][l] + 1 - (r - l + 1) > k) l++;
    ans = max(ans, r - l + 1);
  }
  return ans;
}
void solve() {
  cin >> n >> m >> k;
  for (long long int i = 1; i <= n; i++) {
    cin >> arr[i];
    a[arr[i]].push_back(i);
  }
  long long int ans = 0;
  for (long long int i = 1; i <= m; i++) ans = max(ans, check(i));
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) solve();
}
