#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const long double PI = 3.14159265358979;
inline int gcd(int a, int b) { return (b ? gcd(b, a % b) : a); }
inline int lcm(int a, int b) { return a / gcd(a, b) * b; }
const long long int mod = 1e9 + 7;
const long long int maxn = 2e5 + 10;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  int tcs = 1;
  while (tcs--) {
    int n, m, k;
    cin >> n >> m >> k;
    int a;
    vector<int> vec[maxn];
    for (int i = 1; i <= n; i++) {
      cin >> a;
      vec[a].push_back(i);
    }
    int ans = 1;
    for (int i = 1; i <= m; i++) {
      int gap_ele = 0, l = 1, cnt = 1;
      for (int j = 1; j < vec[i].size(); j++) {
        gap_ele += vec[i][j] - vec[i][j - 1] - 1;
        cnt++;
        while (gap_ele > k) {
          gap_ele -= vec[i][l] - vec[i][l - 1] - 1;
          cnt--;
          l++;
        }
        ans = max(ans, cnt);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
