#include <bits/stdc++.h>
using namespace std;
const int N = 7 + 200000;
int n, m, k, num;
vector<int> g[N];
int j, ans;
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    scanf("%d", &num);
    g[num].push_back(i);
  }
  for (int now = 1; now <= m; now++) {
    j = 0;
    for (int i = 0; i < g[now].size(); i++) {
      for (; j < g[now].size(); j++) {
        if (g[now][j] - g[now][i] + 1 - (j - i + 1) > k) {
          break;
        }
        ans = max(ans, j - i + 1);
      }
    }
  }
  cout << ans;
  return 0;
}
