#include <bits/stdc++.h>
using namespace std;
vector<int> V[200010];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    V[a].push_back(i);
  }
  int res = 1;
  for (int i = 1; i <= m; i++) {
    int MAX = 1;
    int cnt = 0;
    deque<int> tmp;
    for (int j = 1; j < V[i].size(); j++) {
      int a1 = V[i][j - 1];
      int a2 = V[i][j];
      tmp.push_back(a2 - a1 - 1);
      cnt += a2 - a1 - 1;
      if (cnt > k) {
        res = max(res, MAX);
        while (cnt > k) {
          cnt -= tmp.front();
          MAX--;
          tmp.pop_front();
        }
        MAX++;
      } else
        MAX++;
    }
    res = max(res, MAX);
  }
  cout << res;
  return (0);
}
