#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T gi() {
  T f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return f * x;
}
const int INF = 0x3f3f3f3f, N = 200003, M = N << 1;
int n, m, k, a[N];
vector<int> v[N];
namespace BIT {
int tr[N];
void add(int x, int val) {
  for (int i = x; i <= m; i += (i & (-i))) tr[i] += val;
}
int query(int x) {
  int res = 0;
  for (int i = x; i; i -= (i & (-i))) res += tr[i];
  return res;
}
}  // namespace BIT
int main() {
  n = gi<int>(), m = gi<int>(), k = gi<int>();
  for (int i = 1; i <= n; i += 1) {
    a[i] = gi<int>();
    v[a[i]].push_back(i);
  }
  int ans = 0;
  for (int i = 1; i <= m; i += 1) {
    int l = 0, r = 0;
    while (l <= (int)v[i].size() - 1) {
      while (r <= (int)v[i].size() - 1 &&
             (v[i][r] - v[i][l] + 1 - (r - l + 1)) <= k)
        ++r;
      --r;
      ans = max(ans, r - l + 1);
      ++l;
    }
  }
  printf("%d\n", ans);
  return 0;
}
