#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
inline int readint(){
int n = 0;
char ch = getchar();
while(ch < ‘0‘ || ch > ‘9‘) ch = getchar();
while(ch <= ‘9‘ && ch >= ‘0‘){
n = (n << 1) + (n << 3) + ch - ‘0‘;
ch = getchar();
}
return n;
}
const int maxn = 100000 + 10;
int n, c, m;
int a[maxn], belong[maxn], block_size;
int f[1500][1500], tax[maxn];
inline void work(int x){
int ans = 0;
for(int i = (x - 1) * block_size + 1; i <= n; i++) tax[a[i]] = 0;
for(int i = (x - 1) * block_size + 1; i <= n; i++){
tax[a[i]]++;
if((tax[a[i]] & 1) && tax[a[i]] != 1) ans--;
if(!(tax[a[i]] & 1)) ans++;
f[x][belong[i]] = ans;
}
}
struct Node{int pos, val;}no[maxn];
inline bool cmp(const Node &a, const Node &b){
return a.val == b.val ? a.pos < b.pos : a.val < b.val;
}
int first[maxn], last[maxn];
inline int upper(int x, int k){
int l = first[x], r = last[x], mid, ret = 0;
while(l <= r){
mid = l + r >> 1;
if(no[mid].pos > k) r = mid - 1;
else{
ret = mid;
l = mid + 1;
}
}
return ret;
}
inline int lower(int x, int k){
int l = first[x], r = last[x], mid, ret = 66662333;
while(l <= r){
mid = l + r >> 1;
if(no[mid].pos < k) l = mid + 1;
else{
ret = mid;
r = mid - 1;
}
}
return ret;
}
inline int Count(int l, int r, int x){
return max(upper(x, r) - lower(x, l) + 1, 0);
}
bool mark[maxn] = {false};
inline int Query(int l, int r){
int ans = 0;
if(belong[r] - belong[l] <= 1){
for(int t, i = l; i <= r; i++){
if(mark[a[i]]) continue;
mark[a[i]] = true;
t = Count(l, r, a[i]);
if(!(t & 1) && t) ans++;
}
for(int i = l; i <= r; i++) mark[a[i]] = false;
return ans;
}
else{
int ll = belong[l] * block_size + 1, rr = (belong[r] - 1) * block_size;
ans = f[belong[ll]][belong[rr]];
for(int x, y, i = l; i < ll; i++){
if(mark[a[i]]) continue;
mark[a[i]] = true;
x = Count(l, r, a[i]);
y = Count(ll, rr, a[i]);
if((x & 1)){
if(!(y & 1) && y) ans--;
}
else if(x && (!y || (y & 1))) ans++;
}
for(int x, y, i = rr + 1; i <= r; i++){
if(mark[a[i]]) continue;
mark[a[i]] = true;
x = Count(l, r, a[i]);
y = Count(ll, rr, a[i]);
if((x & 1)){
if(!(y & 1) && y) ans--;
}
else if(x && (!y || (y & 1))) ans++;
}
for(int i = l; i < ll; i++) mark[a[i]] = false;
for(int i = rr + 1; i <= r; i++) mark[a[i]] = false;
return ans;
}
}
int main(){
n = readint();
c = readint();
m = readint();
block_size = 1.0 * n / sqrt(log2(n + 1) * m);
for(int i = 1; i <= n; i++) belong[i] = (i - 1) / block_size + 1;
for(int i = 1; i <= n; i++){
no[i].val = a[i] = readint();
no[i].pos = i;
}
sort(no + 1, no + n + 1, cmp);
for(int i = 1; i <= n; i++){
if(!first[no[i].val]) first[no[i].val] = i;
last[no[i].val] = i;
}
for(int i = 1; i <= n; i++) work(i);
for(int l, r, ans = 0, i = 1; i <= m; i++){
l = (readint() + ans) % n + 1;
r = (readint() + ans) % n + 1;
if(l > r) swap(l, r);
printf("%d\n", ans = Query(l, r));
}
return 0;
}