#include <bits/stdc++.h>
using namespace std;
long long Set(long long N, long long pos) { return N = N | (1 << pos); }
long long reset(long long N, long long pos) { return N = N & ~(1 << pos); }
bool check(long long N, long long pos) { return (bool)(N & (1 << pos)); }
void CI(int &_x) { scanf("%d", &_x); }
void CO(long long &_x) { cout << _x; }
template <typename T>
void getarray(T a[], long long n) {
  for (long long i = 0; i < n; i++) cin >> a[i];
}
template <typename T>
void prLLIarray(T a[], long long n) {
  for (long long i = 0; i < n - 1; i++) cout << a[i] << " ";
  cout << a[n - 1] << endl;
}
const double EPS = 1e-9;
const long long INF = 0x7f7f7f7f;
long long dr8[8] = {1, -1, 0, 0, 1, -1, -1, 1};
long long dc8[8] = {0, 0, -1, 1, 1, 1, -1, -1};
long long dr4[4] = {0, 0, 1, -1};
long long dc4[4] = {-1, 1, 0, 0};
long long kn8r[8] = {1, 2, 2, 1, -1, -2, -2, -1};
long long kn8c[8] = {2, 1, -1, -2, -2, -1, 1, 2};
int ar[200005];
int kount[200005];
int tree[200005 * 4];
int query(int node, int b, int e, int x, int y) {
  if (x > e || b > y) return 0;
  if (b >= x && e <= y) return tree[node];
  int left = node * 2;
  int right = left + 1;
  int mid = (b + e) / 2;
  int p1 = query(left, b, mid, x, y);
  int p2 = query(right, mid + 1, e, x, y);
  return max(p1, p2);
}
void update(int node, int b, int e, int in, int newvalue) {
  if (in > e || in < b) return;
  if (b == e) {
    tree[node] += newvalue;
    return;
  }
  int left = node * 2;
  int right = left + 1;
  int mid = (b + e) / 2;
  update(left, b, mid, in, newvalue);
  update(right, mid + 1, e, in, newvalue);
  tree[node] = max(tree[left], tree[right]);
}
int main() {
  int n, m, k;
  CI(n);
  CI(m);
  CI(k);
  for (long long i = 1; i <= n; i++) {
    CI(ar[i]);
  }
  int ans = 0;
  int maxi = 0, num;
  deque<int> Q;
  int total = 0;
  for (int i = 1; i <= n; i++) {
    Q.push_back(i);
    total = Q.size();
    update(1, 1, 200000, ar[i], 1);
    int maxi = query(1, 1, 200000, 1, 200000);
    while (total - maxi > k) {
      int t = Q.front();
      Q.pop_front();
      total--;
      update(1, 1, 200000, ar[t], -1);
      maxi = query(1, 1, 200000, 1, 200000);
    }
    ans = max(ans, maxi);
  }
  cout << ans << "\n";
}
