#include<bits/stdc++.h>
#define ctn continue
#define I ios::sync_with_stdio(0);
#define AK cin.tie(0);
#define CSP cout.tie(0);
#define endl "\n"
#define MAXN 200005
using namespace std;
int m,k,n,ans=0;
queue<int> pos[MAXN];
bool has[MAXN];
int mac[MAXN],use=0;
int ice[MAXN],where;
struct node
{
int a1,b1;
friend bool operator<(node a,node b)
{
if(a.a1!=b.a1) return a.a1<b.a1;
return a.b1<b.b1;
}
};
priority_queue<node> q;
int c[200005],position[200005],xia[200005];
int counter,answer;
bool have[200005];
inline node mp(int x,int y)
{
node zc;
zc.a1=x,zc.b1=y;
return zc;
}
void an_pai(int x)
{
pos[x].pop();
if(!has[x])
{
ans++;
if(use<k)
{
mac[++use] = x;
has[x]=true;
return;
}
int far=0,bes;
for(int i=1;i<=use;i++)
{
if(pos[mac[i]].empty())
{
has[mac[i]]=false;
has[x]=true;
mac[i]=x;
return;
}
else if(far<pos[mac[i]].front()) far=pos[mac[i]].front(),bes=i;
}
has[mac[bes]]=false;
mac[bes]=x;
has[x]=true;
}
}
int main()
{
scanf("%d%d%d",&n,&m,&k);
if(k<=100)
{
for(int i=1,x;i<=n;i++)
{
scanf("%d",&x);
pos[x].push(i);
ice[i]=x;
}
for(where=1;where<=n;where++) an_pai(ice[where]);
printf("%d",ans);
return 0;
}
else
{
I AK CSP
cin>>n>>m>>k;
for(int i=1;i<=n;i++)
{
xia[i]=n+1;
cin>>c[i];
}
for(int i=1;i<=n;i++)
{
xia[position[c[i]]]=position[c[i]]=i;
}
for(int i=1;i<=n;i++)
{
if(have[c[i]])
{
q.push(mp(xia[i],c[i]));
ctn;
}
if(counter==k)
{
int linshi=q.top().b1;
have[linshi]=false;
q.pop();
counter-=1;
}
q.push(mp(xia[i],c[i]));
have[c[i]]=true;
counter++,answer++;
}
cout<<answer<<endl;
return 0;
}
}