#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  vector<long long> v[m + 1];
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    v[a[i]].push_back(i + 1);
  }
  long long ans = 0;
  for (long long i = 1; i <= m; i++) {
    long long start = 0;
    long long end = 0;
    if (v[i].size() == 0) continue;
    while ((v[i][end] - v[i][start] - (end - start)) <= k) {
      ans = max(ans, end - start + 1);
      end++;
      if (end == v[i].size()) break;
      while ((v[i][end] - v[i][start] - (end - start)) > k) start++;
    }
  }
  cout << ans << endl;
  return 0;
}
