#include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * 100005;
vector<int> v[maxn];
int s[maxn], a[maxn];
int n, m, k;
int main() {
  while (scanf("%d%d%d", &n, &m, &k) != EOF) {
    for (int i = 1; i <= m; i++) v[i].clear();
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      v[a[i]].push_back(i);
      s[i] = (int)v[a[i]].size() - 1;
    }
    int Max = 0;
    for (int i = 1; i <= n; i++) {
      int l = s[i], r = (int)v[a[i]].size() - 1;
      int ans = 0;
      while (l <= r) {
        int mid = (l + r) / 2;
        int len = (v[a[i]][mid] - i + 1);
        int num = s[v[a[i]][mid]] - s[i] + 1;
        if (len - num <= k) {
          ans = num;
          l = mid + 1;
        } else
          r = mid - 1;
      }
      Max = max(Max, ans);
    }
    cout << Max << endl;
  }
  return 0;
}
