#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100, maxm = 1e5 + 100;
pair<int, int> arr[maxn];
vector<int> pos[maxm];
int n, m, k;
bool check(int x) {
  for (int i = 0; i < n; i++)
    if (arr[i].second >= x &&
        i - pos[arr[i].first][arr[i].second - x] + 1 <= k + x)
      return true;
  return false;
}
int bs(int l, int r) {
  if (r == l + 1) return l;
  int mid = (l + r) / 2;
  if (check(mid)) return bs(mid, r);
  return bs(l, mid);
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i].first);
    arr[i].second = (int)pos[arr[i].first].size() + 1;
    pos[arr[i].first].push_back(i);
  }
  printf("%d\n", bs(0, maxn));
}
