#include <bits/stdc++.h>
static const int MOD = 1000000007;
using ll = long long;
using uint = unsigned;
using ull = unsigned long long;
using namespace std;
template <class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<int>> v(m);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    x--;
    v[x].emplace_back(i - v[x].size());
  }
  int ans = 0;
  for (int i = 0; i < m; ++i) {
    int l = 0;
    for (int j = 0; j < v[i].size(); ++j) {
      while (v[i][j] - v[i][l] > k) l++;
      ans = max(ans, j - l + 1);
    }
  }
  cout << ans << "\n";
  return 0;
}
