#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 100;
vector<int> pos[MAXN];
int a[MAXN];
inline int get(int l, int r, int c) {
  return lower_bound(pos[c].begin(), pos[c].end(), r) -
         lower_bound(pos[c].begin(), pos[c].end(), l);
}
int main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    pos[a[i]].push_back(i);
  }
  int ans = 1;
  for (int i = 0; i < n; i++) {
    int l = 1, r = n - i + 1;
    while (l + 1 < r) {
      int mid = (l + r) / 2;
      if (mid - get(i, i + mid, a[i]) <= k)
        l = mid;
      else
        r = mid;
    }
    ans = max(ans, get(i, i + l, a[i]));
  }
  cout << ans << endl;
}
