#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<int> > pos(m + 1);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    pos[x].push_back(i);
  }
  int ans = 0;
  for (int i = 1; i <= m; i++) {
    int l = 0;
    for (int r = 0; r < pos[i].size(); r++) {
      while (pos[i][r] - pos[i][l] - (r - l) > k) l++;
      ans = max(ans, r - l + 1);
    }
  }
  cout << ans;
}
