#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  long long n, m, k;
  cin >> n >> m >> k;
  long long a[n + 1];
  set<pair<long long, long long>> s;
  map<long long, long long> mp;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    s.insert({0, a[i]});
  }
  long long ans = 0;
  for (long long i = 1, j = 1; i <= n; i++) {
    s.erase({mp[a[i]], a[i]});
    mp[a[i]]++;
    s.insert({mp[a[i]], a[i]});
    while (i - j - k >= s.rbegin()->first) {
      s.erase({mp[a[j]], a[j]});
      mp[a[j]]--;
      j++;
      s.insert({mp[a[j]], a[j]});
    }
    ans = max(ans, s.rbegin()->first);
  }
  cout << ans;
  return 0;
}
