#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m, k;
int a[N], bl[N];
struct stu
{
int l, r;
int id;
}ask[N];
int l, r;
long long now;
int cnt[2000010];
long long ans[N];
bool cmp(stu a1, stu a2)
{
return bl[a1.l] ^ bl[a2.l] ? a1.l < a2.l : (bl[a1.l] & 1 ? a1.r < a2.r : a1.r > a2.r) ;
}
void add(int x)
{
now += cnt[a[x] ^ k];
cnt[a[x]]++;
}
void del(int x)
{
cnt[a[x]]--;
now -= cnt[a[x] ^ k];
}
int main()
{
std::ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n >> m >> k;
int nm = sqrt(n);
for(int i = 1; i <= n; i++)
{
int x;
cin >> x;
a[i] = a[i - 1] ^ x;
bl[i] = (i - 1) / nm + 1;
}
for(int i = 1; i <= m; i++)
{
cin >> ask[i].l >> ask[i].r;
ask[i].id = i;
}
sort(ask + 1, ask + n + 1, cmp);
cnt[0] = 1;
for(int i = 1; i <= m; i++)
{
ask[i].l--;
while(l > ask[i].l) add(--l);
while(r < ask[i].r) add(++r);
while(l < ask[i].l) del(l++);
while(r > ask[i].r) del(r--);
ans[ask[i].id] = now;
}
for(int i = 1; i <= m; i++) cout << ans[i] << "\n";
return 0;
}