#include<bits/stdc++.h>
#define RG register
#define il inline
#define db double
#define LL long long
#define N 1000010
#define lowbit (i&-i)
using namespace std;
int tree[N],n,nxt[N],beg[N],col[N],con[N],m,c;bool vis[N];
void Insert(int pos,int num){for(int i=pos;i<=n;i+=lowbit)tree[i]+=num;return;}
int Query(int pos){int sum(0);for(int i=pos;i;i-=lowbit)sum+=tree[i];return sum;}
struct q{
int l,r,id,ans;
void read(int x){id=x;scanf("%d%d",&l,&r);}
}Q[N];
bool comp(const q & a,const q & b){return a.l==b.l?a.r<b.r:a.l<b.l;}
bool Comp(const q & a,const q & b){return a.id<b.id;}
int main(){
scanf("%d%d%d",&n,&c,&m);
for(int i=1;i<=n;++i)scanf("%d",&col[i]),beg[col[i]]=con[col[i]]=i;
for(int i=n;i;--i)
if(beg[col[i]]!=i){
nxt[i]=con[col[i]];
con[col[i]]=i;
}
for(int i=1;i<=c;++i)if(nxt[con[i]])Insert(nxt[con[i]],1);
for(int i=1;i<=m;++i)Q[i].read(i);
sort(Q+1,Q+m+1,comp);
int l=1;
for(int i=1;i<=m;++i){
while(l<Q[i].l){
if(nxt[l])Insert(nxt[l],-1);
if(nxt[nxt[l]])Insert(nxt[nxt[l]],1);
l++;
}
Q[i].ans=Query(Q[i].r)-Query(Q[i].l-1);
}
sort(Q+1,Q+m+1,Comp);
for(int i=1;i<=m;++i)cout<<Q[i].ans<<"\n";
return 0;
}