#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n, m, k, x;
  cin >> n >> m >> k;
  vector<long long int> v[m + 1];
  for (long long int i = 0; i < n; i++) {
    cin >> x;
    v[x].push_back(i + 1);
  }
  long long int ans = 1;
  for (long long int i = 1; i < m + 1; i++) {
    if (v[i].size() == 0) {
      continue;
    }
    long long int l = 0;
    long long int r = 1;
    long long int res = 0;
    while (l < v[i].size()) {
      while (r < v[i].size()) {
        res = v[i][r] - (v[i][l] - 1) - (r - l + 1);
        if (res <= k) {
          ans = max(ans, r - l + 1);
          ++r;
        } else {
          break;
        }
      }
      if (r == v[i].size()) {
        break;
      }
      ++l;
      res -= v[i][l] - v[i][l - 1] - 1;
    }
  }
  cout << ans << "\n";
}
