#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
int block, a[maxn], b[maxn];
LL cnt[1111111];
LL ans[maxn];

struct query
{
    int id, l, r;
}Q[maxn];

bool cmp(query A, query B)
{
    if(A.l / block != B.l / block) return A.l / block < B.l / block;
    return A.r < B.r;
}

int main(void)
{
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    for(int i = 1; i <= n; i++) scanf("%d", a + i), b[i] = b[i-1] ^ a[i];
    for(int i = 0; i < m; i++) scanf("%d %d", &Q[i].l, &Q[i].r), Q[i].id = i;
    block = sqrt(n), sort(Q, Q + m, cmp);
    LL tmp = 0LL;
    int L = 1, R = 0;
    for(int i = 0; i < m; i++)
    {
        while(R < Q[i].r) {cnt[b[R]]++; R++; tmp += cnt[k^b[R]];}
        while(L > Q[i].l) {tmp += cnt[k^b[L-2]] + (b[L-2] ^ b[R] == k ? 1LL : 0LL); cnt[b[L-2]]++; L--;}
        while(R > Q[i].r) {tmp -= cnt[k^b[R]]; R--; cnt[b[R]]--;}
        while(L < Q[i].l) {L++; --cnt[b[L-2]]; tmp -= cnt[k^b[L-2]] + (b[L-2] ^ b[R] == k ? 1LL : 0LL);}
        ans[Q[i].id] = tmp;
    }
    for(int i = 0; i < m; i++) printf("%d\n", ans[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
int block, a[maxn], b[maxn];
LL cnt[1111111];
LL ans[maxn];

struct query
{
    int id, l, r;
}Q[maxn];

bool cmp(query A, query B)
{
    if(A.l / block != B.l / block) return A.l / block < B.l / block;
    return A.r < B.r;
}

int main(void)
{
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    for(int i = 1; i <= n; i++) scanf("%d", a + i), b[i] = b[i-1] ^ a[i];
    for(int i = 0; i < m; i++) scanf("%d %d", &Q[i].l, &Q[i].r), Q[i].id = i;
    block = sqrt(n), sort(Q, Q + m, cmp);
    LL tmp = 0LL;
    int L = 1, R = 0;
    for(int i = 0; i < m; i++)
    {
        while(R < Q[i].r) {cnt[b[R]]++; R++; tmp += cnt[k^b[R]];}
        while(L > Q[i].l) {tmp += cnt[k^b[L-2]] + ((b[L-2] ^ b[R]) == k ? 1LL : 0LL); cnt[b[L-2]]++; L--;}
        while(R > Q[i].r) {tmp -= cnt[k^b[R]]; R--; cnt[b[R]]--;}
        while(L < Q[i].l) {L++; --cnt[b[L-2]]; tmp -= cnt[k^b[L-2]] +( (b[L-2] ^ b[R] )== k ? 1LL : 0LL);}
        ans[Q[i].id] = tmp;
    }
    for(int i = 0; i < m; i++) printf("%d\n", ans[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
int block, a[maxn], b[maxn];
int cnt[1111111];
LL ans[maxn];

struct query
{
    int id, l, r;
}Q[maxn];

bool cmp(query A, query B)
{
    if(A.l / block != B.l / block) return A.l / block < B.l / block;
    return A.r < B.r;
}

int main(void)
{
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    for(int i = 1; i <= n; i++) scanf("%d", a + i), b[i] = b[i-1] ^ a[i];
    for(int i = 0; i < m; i++) scanf("%d %d", &Q[i].l, &Q[i].r), Q[i].id = i;
    block = sqrt(n), sort(Q, Q + m, cmp);
    LL tmp = 0LL;
    int L = 1, R = 0;
    for(int i = 0; i < m; i++)
    {
        while(R < Q[i].r) tmp += (LL) cnt[k^b[R+1]] + (a[R+1] == k), ++cnt[b[R++]];
        while(L > Q[i].l) tmp += (LL) cnt[k^b[L-2]] + (b[L-2] ^ b[R] == k), cnt[b[L-2]]++, L--;
        while(R > Q[i].r) tmp -= (LL) cnt[k^b[R]], cnt[b[--R]]--;
        while(L < Q[i].l) tmp -= (LL) cnt[k^b[L-1]] - (k == 0) + (b[L-1] ^ b[R] == k), cnt[b[L-1]]--, L++;
        ans[Q[i].id] = tmp;
    }
    for(int i = 0; i < m; i++) printf("%d\n", ans[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
int block, a[maxn], b[maxn];
LL cnt[1111111];
LL ans[maxn];

struct query
{
    int id, l, r;
}Q[maxn];

bool cmp(query A, query B)
{
    if(A.l / block != B.l / block) return A.l / block < B.l / block;
    return A.r < B.r;
}

int main(void)
{
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    for(int i = 1; i <= n; i++) scanf("%d", a + i), b[i] = b[i-1] ^ a[i];
    for(int i = 0; i < m; i++) scanf("%d %d", &Q[i].l, &Q[i].r), Q[i].id = i;
    block = sqrt(n), sort(Q, Q + m, cmp);
    LL tmp = 0LL;
    int L = 1, R = 0;
    for(int i = 0; i < m; i++)
    {
        while(R < Q[i].r) ++cnt[b[R++]], tmp += cnt[k^b[R]];
        while(L > Q[i].l) tmp += cnt[k^b[L-2]] + ( (b[L-2] ^ b[R] == k) ? 1LL : 0LL ), cnt[b[L-2]]++, L--;
        while(R > Q[i].r) tmp -= cnt[k^b[R]], cnt[b[--R]]--;
        while(L < Q[i].l) L++, --cnt[b[L-2]], tmp -= cnt[k^b[L-2]] + ( (b[L-2] ^ b[R]) == k ? 1LL : 0LL );
        ans[Q[i].id] = tmp;
    }
    for(int i = 0; i < m; i++) printf("%d\n", ans[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
int block, a[maxn], b[maxn];
int cnt[1111111];
LL ans[maxn];

struct query
{
    int id, l, r;
}Q[maxn];

bool cmp(query A, query B)
{
    if(A.l / block != B.l / block) return A.l / block < B.l / block;
    return A.r < B.r;
}

int main(void)
{
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    for(int i = 1; i <= n; i++) scanf("%d", a + i), b[i] = b[i-1] ^ a[i];
    for(int i = 0; i < m; i++) scanf("%d %d", &Q[i].l, &Q[i].r), Q[i].id = i;
    block = sqrt(n), sort(Q, Q + m, cmp);
    LL tmp = 0LL;
    int L = 1, R = 0;
    for(int i = 0; i < m; i++)
    {
        while(R < Q[i].r) tmp += (LL) cnt[k^b[R+1]] + (a[R+1] == k), ++cnt[b[R++]];
        while(R > Q[i].r) tmp -= (LL) cnt[k^b[R]], cnt[b[--R]]--;
        while(L > Q[i].l) tmp += (LL) cnt[k^b[L-2]] + (b[L-2] ^ b[R] == k), cnt[b[L-2]]++, L--;
        while(L < Q[i].l) tmp -= (LL) cnt[k^b[L-1]] - (k == 0) + (b[L-1] ^ b[R] == k), cnt[b[L-1]]--, L++;
        ans[Q[i].id] = tmp;
    }
    for(int i = 0; i < m; i++) printf("%d\n", ans[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
int block, a[maxn], b[maxn];
LL cnt[1111111];
LL ans[maxn];

struct query
{
    int id, l, r;
}Q[maxn];

bool cmp(query A, query B)
{
    if(A.l / block != B.l / block) return A.l / block < B.l / block;
    return A.r < B.r;
}

int main(void)
{
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    for(int i = 1; i <= n; i++) scanf("%d", a + i), b[i] = b[i-1] ^ a[i];
    for(int i = 0; i < m; i++) scanf("%d %d", &Q[i].l, &Q[i].r), Q[i].id = i;
    block = sqrt(n), sort(Q, Q + m, cmp);
    LL tmp = 0LL;
    int L = 1, R = 0;
    for(int i = 0; i < m; i++)
    {
        while(R < Q[i].r) {++cnt[b[R++]]; tmp += cnt[k^b[R]];}
        while(L > Q[i].l) {tmp += cnt[k^b[L-2]] + (b[L-2] ^ b[R] == k ? 1LL : 0LL); cnt[b[L-2]]++; L--;}
        while(R > Q[i].r) {tmp -= cnt[k^b[R]]; cnt[b[--R]]--;}
        while(L < Q[i].l) {L++; --cnt[b[L-2]]; tmp -= cnt[k^b[L-2]] + (b[L-2] ^ b[R] == k ? 1LL : 0LL);}
        ans[Q[i].id] = tmp;
    }
    for(int i = 0; i < m; i++) printf("%d\n", ans[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
int block, a[maxn], b[maxn];
LL cnt[1111111];
LL ans[maxn];

struct query
{
    int id, l, r;
}Q[maxn];

bool cmp(query A, query B)
{
    if(A.l / block != B.l / block) return A.l / block < B.l / block;
    return A.r < B.r;
}

int main(void)
{
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    for(int i = 1; i <= n; i++) scanf("%d", a + i), b[i] = b[i-1] ^ a[i];
    for(int i = 0; i < m; i++) scanf("%d %d", &Q[i].l, &Q[i].r), Q[i].id = i;
    block = sqrt(n), sort(Q, Q + m, cmp);
    LL tmp = 0LL;
    int L = 1, R = 0;
    for(int i = 0; i < m; i++)
    {
        while(R < Q[i].r) {cnt[b[R]]++; R++; tmp += cnt[k^b[R]];}
        while(L > Q[i].l) {tmp += cnt[k^b[L-2]] + ((b[L-2] ^ b[R]) == k ? 1LL : 0LL); cnt[b[L-2]]++; L--;}
        while(R > Q[i].r) {tmp -= cnt[k^b[R]]; R--; cnt[b[R]]--;}
        while(L < Q[i].l) {L++; --cnt[b[L-2]]; tmp -= cnt[k^b[L-2]] +( (b[L-2] ^ b[R] )== k ? 1LL : 0LL);}
        ans[Q[i].id] = tmp;
    }
    for(int i = 0; i < m; i++) printf("%I64d\n", ans[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
int block, a[maxn], b[maxn];
LL cnt[1111111];
LL ans[maxn];

struct query
{
    int id, l, r;
}Q[maxn];

bool cmp(query A, query B)
{
    if(A.l / block != B.l / block) return A.l / block < B.l / block;
    return A.r < B.r;
}

int main(void)
{
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    for(int i = 1; i <= n; i++) scanf("%d", a + i), b[i] = b[i-1] ^ a[i];
    for(int i = 0; i < m; i++) scanf("%d %d", &Q[i].l, &Q[i].r), Q[i].id = i;
    block = sqrt(n), sort(Q, Q + m, cmp);
    LL tmp = 0LL;
    int L = 1, R = 0;
    for(int i = 0; i < m; i++)
    {
        while(R < Q[i].r) ++cnt[b[R++]], tmp += cnt[k^b[R]];
        while(L > Q[i].l) tmp += cnt[k^b[L-2]] + (b[L-2] ^ b[R] == k) ? 1LL : 0LL, cnt[b[L-2]]++, L--;
        while(R > Q[i].r) tmp -= cnt[k^b[R]], cnt[b[--R]]--;
        while(L < Q[i].l) L++, --cnt[b[L-2]], tmp -= cnt[k^b[L-2]] + (b[L-2] ^ b[R]) == k ? 1LL : 0LL;
        ans[Q[i].id] = tmp;
    }
    for(int i = 0; i < m; i++) printf("%d\n", ans[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
int block, a[maxn], b[maxn];
int cnt[1111111];
LL ans[maxn];

struct query
{
    int id, l, r;
}Q[maxn];

bool cmp(query A, query B)
{
    if(A.l / block != B.l / block) return A.l / block < B.l / block;
    return A.r < B.r;
}

int main(void)
{
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    for(int i = 1; i <= n; i++) scanf("%d", a + i), b[i] = b[i-1] ^ a[i];
    for(int i = 0; i < m; i++) scanf("%d %d", &Q[i].l, &Q[i].r), Q[i].id = i;
    block = sqrt(n), sort(Q, Q + m, cmp);
    LL tmp = 0LL;
    int L = 1, R = 0;
    for(int i = 0; i < m; i++)
    {
        while(R < Q[i].r) tmp += (LL) cnt[k^b[R+1]] + (b[R+1] ^ b[L-1] == k), cnt[b[++R]]++;
        while(R > Q[i].r) tmp -= (LL) cnt[k^b[R]] + (b[R] ^ b[L-1] == k) - (k == 0), --cnt[b[R--]];
        while(L > Q[i].l) tmp += (LL) cnt[k^b[L-2]] + (a[--L] == k), cnt[b[L]]++;
        while(L < Q[i].l) tmp -= (LL) cnt[k^b[L-1]], --cnt[b[L++]];
        ans[Q[i].id] = tmp;
    }
    for(int i = 0; i < m; i++) printf("%d\n", ans[i]);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef int  ll;
static ll block,cnt;
long long int ans=0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
struct node
{
        ll first,second,index;
};
struct node p[1000010];
int freq[1000010];
ll n,k,q,a[1000010],i;
long long int fin[1000010],fxor[1000010];
inline bool comp(struct node p1,struct node p2)
{
        if(p1.first/block==p2.first/block)
                return p1.second<p2.second;
               return p1.first/block<p2.first/block;
}
inline void remove(ll pos)
{
        freq[fxor[pos]]--;
        ans-=freq[fxor[pos]^k];
}

inline void add(ll pos)
{
       ans+=freq[fxor[pos]^k];
       freq[fxor[pos]]++;
}
int main()
{
        fast;
        cin>>n>>q>>k;
        block=sqrt(n);
        for(i=1;i<=n;i++)
        cin>>a[i];
        fxor[0]=0;
        for(i=1;i<=n;i++)
        fxor[i]=fxor[i-1]^a[i];
        for(i=0;i<q;i++)
        {
                cin>>p[i].first>>p[i].second;
                p[i].first--;
                p[i].index=i;
        }
        sort(p,p+q,comp);
        ll lp=p[0].first;
	ll rp=p[0].first-1;
	for(i=0;i<q;i++)
	{
		ll left=p[i].first;
		ll right=p[i].second;
                while(lp<left)
		{
			remove(lp);
			lp++;
		}
		while(lp>left)
		{
			lp--;
			add(lp);
		}
		while(rp<right)
		{
		        rp++;
			add(rp);
		}
		while(rp>right)
		{
			remove(rp);
			rp--;
		}
		fin[p[i].index]=ans;
	}
	for(i=0;i<q;i++)
	{
	       cout<<fin[i]<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
typedef int  ll;
static ll block,cnt;
long long int ans=0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
struct node
{
        ll first,second,index;
};
struct node p[1000010];
unordered_map<int,int> freq;
ll n,k,q,a[1000010],i;
long long int fin[1000010],fxor[1000010];
inline bool comp(struct node p1,struct node p2)
{
        if(p1.first/block==p2.first/block)
                return p1.second<p2.second;
               return p1.first/block<p2.first/block;
}
inline void remove(ll pos)
{
        freq[fxor[pos]]--;
        ans-=freq[fxor[pos]^k];
}

inline void add(ll pos)
{
       ans+=freq[fxor[pos]^k];
       freq[fxor[pos]]++;
}
int main()
{
        fast;
        cin>>n>>q>>k;
        block=sqrt(n);
        for(i=1;i<=n;i++)
        cin>>a[i];
        fxor[0]=0;
        for(i=1;i<=n;i++)
        fxor[i]=fxor[i-1]^a[i];
        for(i=0;i<q;i++)
        {
                cin>>p[i].first>>p[i].second;
                p[i].first--;
                p[i].index=i;
        }
        sort(p,p+q,comp);
        ll lp=p[0].first;
	ll rp=p[0].first-1;
	for(i=0;i<q;i++)
	{
		ll left=p[i].first;
		ll right=p[i].second;
                while(lp<left)
		{
			remove(lp);
			lp++;
		}
		while(lp>left)
		{
			lp--;
			add(lp);
		}
		while(rp<right)
		{
		        rp++;
			add(rp);
		}
		while(rp>right)
		{
			remove(rp);
			rp--;
		}
		fin[p[i].index]=ans;
	}
	for(i=0;i<q;i++)
	{
	       cout<<fin[i]<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
typedef int  ll;
static ll block,cnt,ans=0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
struct node
{
        ll first,second,index;
};
struct node p[1000010];
unordered_map<long long int,long long int> freq;
ll n,k,q,a[1000010],fin[1000010],fxor[1000010],i;
inline bool comp(struct node p1,struct node p2)
{
        if(p1.first/block==p2.first/block)
                return p1.second<p2.second;
               return p1.first/block<p2.first/block;
}
inline void remove(ll pos)
{
        freq[fxor[pos]]--;
        ans-=freq[fxor[pos]^k];
}

inline void add(ll pos)
{
       ans+=freq[fxor[pos]^k];
       freq[fxor[pos]]++;
}
int main()
{
        fast;
        cin>>n>>q>>k;
        block=sqrt(n);
        for(i=1;i<=n;i++)
        cin>>a[i];
        fxor[0]=0;
        for(i=1;i<=n;i++)
        fxor[i]=fxor[i-1]^a[i];
        for(i=0;i<q;i++)
        {
                cin>>p[i].first>>p[i].second;
                p[i].first--;
                p[i].index=i;
        }
        sort(p,p+q,comp);
        ll lp=p[0].first;
	ll rp=p[0].first-1;
	for(i=0;i<q;i++)
	{
		ll left=p[i].first;
		ll right=p[i].second;
                while(lp<left)
		{
			remove(lp);
			lp++;
		}
		while(lp>left)
		{
			lp--;
			add(lp);
		}
		while(rp<right)
		{
		        rp++;
			add(rp);
		}
		while(rp>right)
		{
			remove(rp);
			rp--;
		}
		fin[p[i].index]=ans;
	}
	for(i=0;i<q;i++)
	{
	       cout<<fin[i]<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
static ll block,cnt,ans=0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
struct node
{
        ll first,second,index;
};
struct node p[1000010];
unordered_map<long long int,long long int> freq;
ll n,k,q,a[1000010],fin[1000100],fxor[1000010],i;
inline bool comp(struct node p1,struct node p2)
{
        if(p1.first/block==p2.first/block)
                return p1.second<p2.second;
               return p1.first/block<p2.first/block;
}
inline void remove(ll pos)
{
        freq[fxor[pos]]--;
        ans-=freq[fxor[pos]^k];
}

inline void add(ll pos)
{
       ans+=freq[fxor[pos]^k];
       freq[fxor[pos]]++;
}
int main()
{
        fast;
        cin>>n>>q>>k;
        block=sqrt(n);
        for(i=1;i<=n;i++)
        cin>>a[i];
        fxor[0]=0;
        for(i=1;i<=n;i++)
        fxor[i]=fxor[i-1]^a[i];
        for(i=0;i<q;i++)
        {
                cin>>p[i].first>>p[i].second;
                p[i].first--;
                p[i].index=i;
        }
        sort(p,p+q,comp);
        ll lp=p[0].first;
	ll rp=p[0].first-1;
	for(i=0;i<q;i++)
	{
		ll left=p[i].first;
		ll right=p[i].second;
                while(lp<left)
		{
			remove(lp);
			lp++;
		}
		while(lp>left)
		{
			lp--;
			add(lp);
		}
		while(rp<right)
		{
		        rp++;
			add(rp);
		}
		while(rp>right)
		{
			remove(rp);
			rp--;
		}
		fin[p[i].index]=ans;
	}
	for(i=0;i<q;i++)
	{
	       cout<<fin[i]<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
typedef int  ll;
static ll block,cnt;
long long int ans=0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
struct node
{
        ll first,second,index;
};
struct node p[1000010];
unordered_map<int,int> freq;
ll n,k,q,a[1000010],i;
long long int fin[1000010],fxor[1000010];
inline bool comp(struct node p1,struct node p2)
{
        if(p1.first/block==p2.first/block)
                return p1.second<p2.second;
               return p1.first/block<p2.first/block;
}
inline void remove(ll pos)
{
        freq[fxor[pos]]--;
        ans-=freq[fxor[pos]^k];
}

inline void add(ll pos)
{
       ans+=freq[fxor[pos]^k];
       freq[fxor[pos]]++;
}
int main()
{
        fast;
        scanf("%d%d%d",&n,&q,&k);
        block=sqrt(n);
        for(i=1;i<=n;i++)
        scanf("%d",&a[i]);
        fxor[0]=0;
        for(i=1;i<=n;i++)
        fxor[i]=fxor[i-1]^a[i];
        for(i=0;i<q;i++)
        {
                scanf("%d%d",&p[i].first,&p[i].second);
                p[i].first--;
                p[i].index=i;
        }
        sort(p,p+q,comp);
        ll lp=p[0].first;
	ll rp=p[0].first-1;
	for(i=0;i<q;i++)
	{
		ll left=p[i].first;
		ll right=p[i].second;
                while(lp<left)
		{
			remove(lp);
			lp++;
		}
		while(lp>left)
		{
			lp--;
			add(lp);
		}
		while(rp<right)
		{
		        rp++;
			add(rp);
		}
		while(rp>right)
		{
			remove(rp);
			rp--;
		}
		fin[p[i].index]=ans;
	}
	for(i=0;i<q;i++)
	{
	       printf("%lld\n",fin[i]);
	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
static ll block,cnt,ans=0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
struct node
{
        ll first,second,index;
};
struct node p[1000010];
unordered_map<long long int,long long int> freq;
ll n,k,q,a[10000010],fin[10000100],fxor[10000010],i;
inline bool comp(struct node p1,struct node p2)
{
        if(p1.first/block==p2.first/block)
                return p1.second<p2.second;
               return p1.first/block<p2.first/block;
}
inline void remove(ll pos)
{
        freq[fxor[pos]]--;
        ans-=freq[fxor[pos]^k];
}

inline void add(ll pos)
{
       ans+=freq[fxor[pos]^k];
       freq[fxor[pos]]++;
}
int main()
{
        fast;
        cin>>n>>q>>k;
        block=sqrt(n);
        for(i=1;i<=n;i++)
        cin>>a[i];
        fxor[0]=0;
        for(i=1;i<=n;i++)
        fxor[i]=fxor[i-1]^a[i];
        for(i=0;i<q;i++)
        {
                cin>>p[i].first>>p[i].second;
                p[i].first--;
                p[i].index=i;
        }
        sort(p,p+q,comp);
        ll lp=p[0].first;
	ll rp=p[0].first-1;
	for(i=0;i<q;i++)
	{
		ll left=p[i].first;
		ll right=p[i].second;
                while(lp<left)
		{
			remove(lp);
			lp++;
		}
		while(lp>left)
		{
			lp--;
			add(lp);
		}
		while(rp<right)
		{
		        rp++;
			add(rp);
		}
		while(rp>right)
		{
			remove(rp);
			rp--;
		}
		fin[p[i].index]=ans;
	}
	for(i=0;i<q;i++)
	{
	       cout<<fin[i]<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
typedef int  ll;
static ll block,cnt,ans=0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
struct node
{
        ll first,second,index;
};
struct node p[1000010];
unordered_map<int,int> freq;
ll n,k,q,a[1000010],fin[1000100],fxor[1000010],i;
inline bool comp(struct node p1,struct node p2)
{
        if(p1.first/block==p2.first/block)
                return p1.second<p2.second;
               return p1.first/block<p2.first/block;
}
inline void remove(ll pos)
{
        freq[fxor[pos]]--;
        ans-=freq[fxor[pos]^k];
}

inline void add(ll pos)
{
       ans+=freq[fxor[pos]^k];
       freq[fxor[pos]]++;
}
int main()
{
        fast;
        cin>>n>>q>>k;
        block=sqrt(n);
        for(i=1;i<=n;i++)
        cin>>a[i];
        fxor[0]=0;
        for(i=1;i<=n;i++)
        fxor[i]=fxor[i-1]^a[i];
        for(i=0;i<q;i++)
        {
                cin>>p[i].first>>p[i].second;
                p[i].first--;
                p[i].index=i;
        }
        sort(p,p+q,comp);
        ll lp=p[0].first;
	ll rp=p[0].first-1;
	for(i=0;i<q;i++)
	{
		ll left=p[i].first;
		ll right=p[i].second;
                while(lp<left)
		{
			remove(lp);
			lp++;
		}
		while(lp>left)
		{
			lp--;
			add(lp);
		}
		while(rp<right)
		{
		        rp++;
			add(rp);
		}
		while(rp>right)
		{
			remove(rp);
			rp--;
		}
		fin[p[i].index]=ans;
	}
	for(i=0;i<q;i++)
	{
	       cout<<fin[i]<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
typedef int  ll;
static ll block,cnt,ans=0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
struct node
{
        ll first,second,index;
};
struct node p[1000010];
unordered_map<long long int,long long int> freq;
ll n,k,q,a[1000010],fin[1000100],fxor[1000010],i;
inline bool comp(struct node p1,struct node p2)
{
        if(p1.first/block==p2.first/block)
                return p1.second<p2.second;
               return p1.first/block<p2.first/block;
}
inline void remove(ll pos)
{
        freq[fxor[pos]]--;
        ans-=freq[fxor[pos]^k];
}

inline void add(ll pos)
{
       ans+=freq[fxor[pos]^k];
       freq[fxor[pos]]++;
}
int main()
{
        fast;
        cin>>n>>q>>k;
        block=sqrt(n);
        for(i=1;i<=n;i++)
        cin>>a[i];
        fxor[0]=0;
        for(i=1;i<=n;i++)
        fxor[i]=fxor[i-1]^a[i];
        for(i=0;i<q;i++)
        {
                cin>>p[i].first>>p[i].second;
                p[i].first--;
                p[i].index=i;
        }
        sort(p,p+q,comp);
        ll lp=p[0].first;
	ll rp=p[0].first-1;
	for(i=0;i<q;i++)
	{
		ll left=p[i].first;
		ll right=p[i].second;
                while(lp<left)
		{
			remove(lp);
			lp++;
		}
		while(lp>left)
		{
			lp--;
			add(lp);
		}
		while(rp<right)
		{
		        rp++;
			add(rp);
		}
		while(rp>right)
		{
			remove(rp);
			rp--;
		}
		fin[p[i].index]=ans;
	}
	for(i=0;i<q;i++)
	{
	       cout<<fin[i]<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
typedef int  ll;
static ll block,cnt,ans=0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
struct node
{
        ll first,second,index;
};
struct node p[1000010];
unordered_map<int,int> freq;
ll n,k,q,a[1000010],i;
long long int fin[1000010],fxor[1000010];
inline bool comp(struct node p1,struct node p2)
{
        if(p1.first/block==p2.first/block)
                return p1.second<p2.second;
               return p1.first/block<p2.first/block;
}
inline void remove(ll pos)
{
        freq[fxor[pos]]--;
        ans-=freq[fxor[pos]^k];
}

inline void add(ll pos)
{
       ans+=freq[fxor[pos]^k];
       freq[fxor[pos]]++;
}
int main()
{
        fast;
        cin>>n>>q>>k;
        block=sqrt(n);
        for(i=1;i<=n;i++)
        cin>>a[i];
        fxor[0]=0;
        for(i=1;i<=n;i++)
        fxor[i]=fxor[i-1]^a[i];
        for(i=0;i<q;i++)
        {
                cin>>p[i].first>>p[i].second;
                p[i].first--;
                p[i].index=i;
        }
        sort(p,p+q,comp);
        ll lp=p[0].first;
	ll rp=p[0].first-1;
	for(i=0;i<q;i++)
	{
		ll left=p[i].first;
		ll right=p[i].second;
                while(lp<left)
		{
			remove(lp);
			lp++;
		}
		while(lp>left)
		{
			lp--;
			add(lp);
		}
		while(rp<right)
		{
		        rp++;
			add(rp);
		}
		while(rp>right)
		{
			remove(rp);
			rp--;
		}
		fin[p[i].index]=ans;
	}
	for(i=0;i<q;i++)
	{
	       cout<<fin[i]<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
static ll block,cnt,ans=0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
struct node
{
        ll first,second,index;
};
struct node p[1000010];
ll freq[10000100];
ll n,k,q,a[10000010],fin[10000100],fxor[10000010],i;
inline bool comp(struct node p1,struct node p2)
{
        if(p1.first/block==p2.first/block)
                return p1.second<p2.second;
               return p1.first/block<p2.first/block;
}
inline void remove(ll pos)
{
        freq[fxor[pos]]--;
        ans-=freq[fxor[pos]^k];
}

inline void add(ll pos)
{
       ans+=freq[fxor[pos]^k];
       freq[fxor[pos]]++;
}
int main()
{
        fast;
        cin>>n>>q>>k;
        block=sqrt(n);
        for(i=1;i<=n;i++)
        cin>>a[i];
        fxor[0]=0;
        for(i=1;i<=n;i++)
        fxor[i]=fxor[i-1]^a[i];
        for(i=0;i<q;i++)
        {
                cin>>p[i].first>>p[i].second;
                p[i].first--;
                p[i].index=i;
        }
        sort(p,p+q,comp);
        ll lp=p[0].first;
	ll rp=p[0].first-1;
	for(i=0;i<q;i++)
	{
		ll left=p[i].first;
		ll right=p[i].second;
                while(lp<left)
		{
			remove(lp);
			lp++;
		}
		while(lp>left)
		{
			lp--;
			add(lp);
		}
		while(rp<right)
		{
		        rp++;
			add(rp);
		}
		while(rp>right)
		{
			remove(rp);
			rp--;
		}
		fin[p[i].index]=ans;
	}
	for(i=0;i<q;i++)
	{
	       cout<<fin[i]<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
static ll block,cnt,ans=0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
struct node
{
        ll first,second,index;
};
struct node p[1000010];
ll freq[1000100];
ll n,k,q,a[1000010],fin[1000100],fxor[1000010],i;
inline bool comp(struct node p1,struct node p2)
{
        if(p1.first/block==p2.first/block)
                return p1.second<p2.second;
               return p1.first/block<p2.first/block;
}
inline void remove(ll pos)
{
        freq[fxor[pos]]--;
        ans-=freq[fxor[pos]^k];
}

inline void add(ll pos)
{
       ans+=freq[fxor[pos]^k];
       freq[fxor[pos]]++;
}
int main()
{
        fast;
        cin>>n>>q>>k;
        block=sqrt(n);
        for(i=1;i<=n;i++)
        cin>>a[i];
        fxor[0]=0;
        for(i=1;i<=n;i++)
        fxor[i]=fxor[i-1]^a[i];
        for(i=0;i<q;i++)
        {
                cin>>p[i].first>>p[i].second;
                p[i].first--;
                p[i].index=i;
        }
        sort(p,p+q,comp);
        ll lp=p[0].first;
	ll rp=p[0].first-1;
	for(i=0;i<q;i++)
	{
		ll left=p[i].first;
		ll right=p[i].second;
                while(lp<left)
		{
			remove(lp);
			lp++;
		}
		while(lp>left)
		{
			lp--;
			add(lp);
		}
		while(rp<right)
		{
		        rp++;
			add(rp);
		}
		while(rp>right)
		{
			remove(rp);
			rp--;
		}
		fin[p[i].index]=ans;
	}
	for(i=0;i<q;i++)
	{
	       cout<<fin[i]<<endl;
	}

}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define maxn 10000001
#define ll long long
#define maxb 1010
ll aa[maxn], cnt[maxn], belong[maxn];
ll n, m, size, bnum, now, ans[maxn],len[maxn];
struct query {
    ll l, r, id;
} q[maxn];

int cmp(query a, query b) {
    return belong[a.l] == belong[b.l] ? a.r < b.r : belong[a.l] < belong[b.l];
}

int main() {
    int k;
    scanf("%d %d %d", &n,&m,&k);
    size = sqrt(n);
    bnum = ceil((double)n / size);
    for(int i = 1; i <= bnum; ++i)
        for(int j = (i - 1) * size + 1; j <= i * size; ++j) {
            belong[j] = i;
        }
    for(int i = 1; i <= n; ++i){
        scanf("%d",&aa[i]);
        aa[i]^=aa[i-1];
    }
    for(int i = 1; i <= m; ++i) {
        scanf("%d %d",&q[i].l,&q[i].r);
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    if(k!=0) cnt[0]=1;
    for(int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while(l<ql){
            now-=cnt[aa[l-1]^k];
            cnt[aa[l-1]]--;
            l++;
        }
        while(l>ql){
            l--;
            cnt[aa[l-1]]++;
            now+=cnt[aa[l-1]^k];
        }
        while(r>qr){
            now-=cnt[aa[r]^k];
            cnt[aa[r]]--;
            r--;
        }
        while(r<qr){
            r++;
            cnt[aa[r]]++;
            now+=cnt[aa[r]^k];
        }
        ans[q[i].id] = now;
    }
    for(int i = 1; i <= m; ++i) {
        cout<<ans[i]<<endl;
    }
    return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;
const int MAX1=0x7f7f7f7f;
const int MAXN=5e6+10;
const int MAX=1e5+10;
typedef long long LL;

struct node{
int l,r,id;
}Q[MAXN];
LL num[MAXN];
LL flag[MAXN]; //ǰ׺�ͳ��ֵĴ���
LL pos[MAXN];  //��Ļ���
LL Ans;
LL ans[MAXN];
int L,R;
LL n,m,k;
bool cmp(node a,node b) //�ֿ�����
{
    if(pos[a.l]==pos[b.l])
        return a.r<b.r;
    return pos[a.l]<pos[b.l];
}
void add(int  x)
{
    Ans+=flag[num[x]^k];
    flag[num[x]]++;
}
void del(int  x)
{
    flag[num[x]]--;  //����ʱ�������䱾����Ҫ��ǰȥ��
    Ans-=flag[num[x]^k];

}
int sz;
int main()
{
    ios::sync_with_stdio(false);
     cin>>n>>m>>k;
     memset(pos,0,sizeof(pos));
     memset(num,0,sizeof(num));
     memset(flag,0,sizeof(flag));
    Ans=0;
    L=1,R=0;
    sz=sqrt(n);//�ֿ�Ĵ�С
    flag[0]=1; //���㲻����ֵҲ������ֵ��
    for(int i=1;i<=n;i++)
    {
        cin>>num[i];
        pos[i]=i/sz;
        num[i]=num[i]^num[i-1];
    }

    for(int i=1;i<=m;i++)
    {
        cin>>Q[i].l>>Q[i].r;
        Q[i].id=i;
    }
    sort(Q+1,Q+1+m,cmp);

    for(int i=1;i<=m;i++)
    {
        while(L<Q[i].l)//L��Ҫ��ѯ���������,���L���� ��ans�������ǡ�L R����ֵ
        {//����Ӧ���ȼ�ȥ��ǰ�� L λ�õ����γɵ���������¹���
            del(L-1);//�������pre[L-1]->pre[R] ���Ի�L-1
            L++;
        }
        while(L>Q[i].l)
        {
            L--;
            add(L-1);
        }
        while(R<Q[i].r)
        {
            R++;
            add(R);
        }
        while(R>Q[i].r)
        {
            del(R);
            R--;
        }

        ans[Q[i].id]=Ans;
    }
    for(int i=1;i<=m;i++)
        cout<<ans[i]<<endl;

return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define maxn 1010000
#define ll long long
#define maxb 1010
vector<int> vt;
ll aa[maxn], cnt[maxn], belong[maxn];
ll n, m, size, bnum, now, ans[maxn],len[maxn];
ll gcd(ll a,ll b){
    if(b==0) return a;
    else return gcd(b,a%b);
}
struct query {
    ll l, r, id;
} q[maxn];

int cmp(query a, query b) {
    return belong[a.l] == belong[b.l] ? a.r < b.r : belong[a.l] < belong[b.l];
}

int main() {
    int k;
    scanf("%d %d %d", &n,&m,&k);
    size = sqrt(n);
    bnum = ceil((double)n / size);
    for(int i = 1; i <= bnum; ++i)
        for(int j = (i - 1) * size + 1; j <= i * size; ++j) {
            belong[j] = i;
        }
    for(int i = 1; i <= n; ++i){
        scanf("%d",&aa[i]);
        aa[i]^=aa[i-1];
    }
    for(int i = 1; i <= m; ++i) {
        scanf("%d %d",&q[i].l,&q[i].r);
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    if(k!=0)cnt[0]=1;
    for(int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while(l<ql){
            now-=cnt[aa[l-1]^k];
            cnt[aa[l-1]]--;
            l++;
        }
        while(l>ql){
            l--;
            cnt[aa[l-1]]++;
            now+=cnt[aa[l-1]^k];
        }
        while(r>qr){
            now-=cnt[aa[r]^k];
            cnt[aa[r]]--;
            r--;
        }
        while(r<qr){
            r++;
            cnt[aa[r]]++;
            now+=cnt[aa[r]^k];
        }
        ans[q[i].id] = now;
    }
    for(int i = 1; i <= m; ++i) {
        cout<<ans[i]<<endl;
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define maxn 1000001
#define ll long long
#define maxb 1010
ll aa[maxn], cnt[maxn], belong[maxn];
ll n, m, size, bnum, now, ans[maxn],len[maxn];
struct query {
    ll l, r, id;
} q[maxn];

int cmp(query a, query b) {
    return belong[a.l] == belong[b.l] ? a.r < b.r : belong[a.l] < belong[b.l];
}

int main() {
    ll k;
    scanf("%d %d %d", &n,&m,&k);
    size = sqrt(n);
    bnum = ceil((double)n / size);
    for(int i = 1; i <= bnum; ++i)
        for(int j = (i - 1) * size + 1; j <= i * size; ++j) {
            belong[j] = i;
        }
    for(int i = 1; i <= n; ++i){
        scanf("%d",&aa[i]);
        aa[i]^=aa[i-1];
    }
    for(int i = 1; i <= m; ++i) {
        scanf("%d %d",&q[i].l,&q[i].r);
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    if(k!=0) cnt[0]=1;
    for(int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while(l<ql){
            now-=cnt[aa[l-1]^k];
            cnt[aa[l-1]]--;
            l++;
        }
        while(l>ql){
            l--;
            cnt[aa[l-1]]++;
            now+=cnt[aa[l-1]^k];
        }
        while(r>qr){
            now-=cnt[aa[r]^k];
            cnt[aa[r]]--;
            r--;
        }
        while(r<qr){
            r++;
            cnt[aa[r]]++;
            now+=cnt[aa[r]^k];
        }
        ans[q[i].id] = now;
    }
    for(int i = 1; i <= m; ++i) {
        cout<<ans[i]<<endl;
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define maxn 1010000
#define ll long long
#define maxb 1010
vector<int> vt;
ll aa[maxn], cnt[maxn], belong[maxn];
ll n, m, size, bnum, now, ans[maxn],len[maxn];
struct query {
    ll l, r, id;
} q[maxn];

int cmp(query a, query b) {
    return belong[a.l] == belong[b.l] ? a.r < b.r : belong[a.l] < belong[b.l];
}

int main() {
    long long k;
    scanf("%d %d %d", &n,&m,&k);
    size = sqrt(n);
    bnum = ceil((double)n / size);
    for(int i = 1; i <= bnum; ++i)
        for(int j = (i - 1) * size + 1; j <= i * size; ++j) {
            belong[j] = i;
        }
    for(int i = 1; i <= n; ++i){
        scanf("%d",&aa[i]);
        aa[i]^=aa[i-1];
    }
    for(int i = 1; i <= m; ++i) {
        scanf("%d %d",&q[i].l,&q[i].r);
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    if(k!=0)cnt[0]=1;
    for(int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while(l<ql){
            now-=cnt[aa[l-1]^k];
            cnt[aa[l-1]]--;
            l++;
        }
        while(l>ql){
            l--;
            cnt[aa[l-1]]++;
            now+=cnt[aa[l-1]^k];
        }
        while(r>qr){
            now-=cnt[aa[r]^k];
            cnt[aa[r]]--;
            r--;
        }
        while(r<qr){
            r++;
            cnt[aa[r]]++;
            now+=cnt[aa[r]^k];
        }
        ans[q[i].id] = now;
    }
    for(int i = 1; i <= m; ++i) {
        cout<<ans[i]<<endl;
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define maxn 1010000
#define ll long long
#define maxb 1010
vector<int> vt;
ll aa[maxn], cnt[maxn], belong[maxn];
ll n, m, size, bnum, now, ans[maxn],len[maxn];
ll gcd(ll a,ll b){
    if(b==0) return a;
    else return gcd(b,a%b);
}
struct query {
    ll l, r, id;
} q[maxn];

int cmp(query a, query b) {
    return belong[a.l] == belong[b.l] ? a.r < b.r : belong[a.l] < belong[b.l];
}

int main() {
    int k;
    scanf("%d %d %d", &n,&m,&k);
    size = sqrt(n);
    bnum = ceil((double)n / size);
    for(int i = 1; i <= bnum; ++i)
        for(int j = (i - 1) * size + 1; j <= i * size; ++j) {
            belong[j] = i;
        }
    for(int i = 1; i <= n; ++i){
        scanf("%d",&aa[i]);
        aa[i]^=aa[i-1];
    }
    for(int i = 1; i <= m; ++i) {
        scanf("%d %d",&q[i].l,&q[i].r);
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    cnt[0]=1;
    for(int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while(l<ql){
            now-=cnt[aa[l-1]^k];
            cnt[aa[l-1]]--;
            l++;
        }
        while(l>ql){
            l--;
            cnt[aa[l-1]]++;
            now+=cnt[aa[l-1]^k];
        }
        while(r>qr){
            now-=cnt[aa[r]^k];
            cnt[aa[r]]--;
            r--;
        }
        while(r<qr){
            r++;
            cnt[aa[r]]++;
            now+=cnt[aa[r]^k];
        }
        ans[q[i].id] = now;
    }
    for(int i = 1; i <= m; ++i) {
        cout<<ans[i]<<endl;
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define maxn 1000001
#define ll long long
#define maxb 1010
ll aa[maxn], cnt[maxn], belong[maxn];
ll n, m, size, bnum, now, ans[maxn],len[maxn];
struct query {
    ll l, r, id;
} q[maxn];

int cmp(query a, query b) {
    return belong[a.l] == belong[b.l] ? a.r < b.r : belong[a.l] < belong[b.l];
}

int main() {
    int k;
    scanf("%d %d %d", &n,&m,&k);
    size = sqrt(n);
    bnum = ceil((double)n / size);
    for(int i = 1; i <= bnum; ++i)
        for(int j = (i - 1) * size + 1; j <= i * size; ++j) {
            belong[j] = i;
        }
    for(int i = 1; i <= n; ++i){
        scanf("%d",&aa[i]);
        aa[i]^=aa[i-1];
    }
    for(int i = 1; i <= m; ++i) {
        scanf("%d %d",&q[i].l,&q[i].r);
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    if(k!=0) cnt[0]=1;
    for(int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while(l<ql){
            now-=cnt[aa[l-1]^k];
            cnt[aa[l-1]]--;
            l++;
        }
        while(l>ql){
            l--;
            cnt[aa[l-1]]++;
            now+=cnt[aa[l-1]^k];
        }
        while(r>qr){
            now-=cnt[aa[r]^k];
            cnt[aa[r]]--;
            r--;
        }
        while(r<qr){
            r++;
            cnt[aa[r]]++;
            now+=cnt[aa[r]^k];
        }
        ans[q[i].id] = now;
    }
    for(int i = 1; i <= m; ++i) {
        cout<<ans[i]<<endl;
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define maxn 1000001
#define ll long long
#define maxb 1010
ll aa[maxn], cnt[maxn], belong[maxn];
ll n, m, size, bnum, now, ans[maxn],len[maxn];
struct query {
    int l, r, id;
} q[maxn];

int cmp(query a, query b) {
    return belong[a.l] == belong[b.l] ? a.r < b.r : belong[a.l] < belong[b.l];
}

int main() {
    int k;
    ios::sync_with_stdio(false);
    cin>>n>>m>>k;
    size = sqrt(n);
    for(int i = 1; i <= n; ++i){
        scanf("%d",&aa[i]);
        aa[i]^=aa[i-1];
        belong[i]=i/size;
    }
    for(int i = 1; i <= m; ++i) {
        scanf("%d %d",&q[i].l,&q[i].r);
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    if(k!=0) cnt[0]=1;
    for(int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while(l<ql){
            now-=cnt[aa[l-1]^k];
            cnt[aa[l-1]]--;
            l++;
        }
        while(l>ql){
            l--;
            cnt[aa[l-1]]++;
            now+=cnt[aa[l-1]^k];
        }
        while(r>qr){
            now-=cnt[aa[r]^k];
            cnt[aa[r]]--;
            r--;
        }
        while(r<qr){
            r++;
            cnt[aa[r]]++;
            now+=cnt[aa[r]^k];
        }
        ans[q[i].id] = now;
    }
    for(int i = 1; i <= m; ++i) {
        cout<<ans[i]<<endl;
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define maxn 1000001
#define ll long long
ll aa[maxn], cnt[maxn], belong[maxn];
ll n, m, size, bnum, now, ans[maxn],len[maxn];
struct query {
    int l, r, id;
} q[maxn];

int cmp(query a, query b) {
    return belong[a.l] == belong[b.l] ? a.r < b.r : belong[a.l] < belong[b.l];
}

int main() {
    int k;
    scanf("%d %d %d", &n,&m,&k);
    size = sqrt(n);
    for(int i = 1; i <= n; ++i){
        scanf("%d",&aa[i]);
        aa[i]^=aa[i-1];
        belong[i]=i/size;
    }
    for(int i = 1; i <= m; ++i) {
        scanf("%d %d",&q[i].l,&q[i].r);
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    if(k!=0) cnt[0]=1;
    for(int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while(l<ql){
            now-=cnt[aa[l-1]^k];
            cnt[aa[l-1]]--;
            l++;
        }
        while(l>ql){
            l--;
            cnt[aa[l-1]]++;
            now+=cnt[aa[l-1]^k];
        }
        while(r>qr){
            now-=cnt[aa[r]^k];
            cnt[aa[r]]--;
            r--;
        }
        while(r<qr){
            r++;
            cnt[aa[r]]++;
            now+=cnt[aa[r]^k];
        }
        ans[q[i].id] = now;
    }
    for(int i = 1; i <= m; ++i) {
        cout<<ans[i]<<endl;
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define ll long long
const int maxn=5e6+10;
ll aa[maxn], cnt[maxn], belong[maxn];
ll n, m, size, bnum, now, ans[maxn],len[maxn];
struct query {
    int l, r, id;
} q[maxn];

int cmp(query a, query b) {
    return belong[a.l] == belong[b.l] ? a.r < b.r : belong[a.l] < belong[b.l];
}

int main() {
    int k;
    scanf("%d %d %d", &n,&m,&k);
    size = sqrt(n);
    for(int i = 1; i <= n; ++i){
        scanf("%d",&aa[i]);
        aa[i]^=aa[i-1];
        belong[i]=i/size;
    }
    for(int i = 1; i <= m; ++i) {
        scanf("%d %d",&q[i].l,&q[i].r);
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    cnt[0]=1;
    for(int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while(l<ql){
            cnt[aa[l-1]]--;
            now-=cnt[aa[l-1]^k];
            l++;
        }
        while(l>ql){
            l--;
            now+=cnt[aa[l-1]^k];
            cnt[aa[l-1]]++;
        }
        while(r>qr){
            cnt[aa[r]]--;
            now-=cnt[aa[r]^k];
            r--;
        }
        while(r<qr){
            r++;
            now+=cnt[aa[r]^k];
            cnt[aa[r]]++;
        }
        ans[q[i].id] = now;
    }
    for(int i = 1; i <= m; ++i) {
        cout<<ans[i]<<endl;
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define maxn 1000001
#define ll long long
ll aa[maxn], cnt[maxn], belong[maxn];
ll n, m, size, bnum, now, ans[maxn],len[maxn];
struct query {
    int l, r, id;
} q[maxn];

int cmp(query a, query b) {
    return belong[a.l] == belong[b.l] ? a.r < b.r : belong[a.l] < belong[b.l];
}

int main() {
    int k;
    scanf("%d %d %d", &n,&m,&k);
    size = sqrt(n);
    for(int i = 1; i <= n; ++i){
        scanf("%d",&aa[i]);
        aa[i]^=aa[i-1];
        belong[i]=i/size;
    }
    for(int i = 1; i <= m; ++i) {
        scanf("%d %d",&q[i].l,&q[i].r);
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    cnt[0]=1;
    for(int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while(l<ql){
            cnt[aa[l-1]]--;
            now-=cnt[aa[l-1]^k];
            l++;
        }
        while(l>ql){
            l--;
            now+=cnt[aa[l-1]^k];
            cnt[aa[l-1]]++;
        }
        while(r>qr){
            cnt[aa[r]]--;
            now-=cnt[aa[r]^k];
            r--;
        }
        while(r<qr){
            r++;
            now+=cnt[aa[r]^k];
            cnt[aa[r]]++;
        }
        ans[q[i].id] = now;
    }
    for(int i = 1; i <= m; ++i) {
        cout<<ans[i]<<endl;
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define maxn 1010000
#define ll long long
#define maxb 1010
const int MAXN=5e6+10;
ll aa[MAXN], cnt[MAXN], belong[MAXN];
ll n, m, size, bnum, now, ans[MAXN];
struct query {
    ll l, r, id;
} q[MAXN];

int cmp(query a, query b) {
    return belong[a.l] == belong[b.l] ? a.r < b.r : belong[a.l] < belong[b.l];
}

int main() {
    int k;
    scanf("%d %d %d", &n,&m,&k);
    size = sqrt(n);
    bnum = ceil((double)n / size);
    for(int i = 1; i <= bnum; ++i)
        for(int j = (i - 1) * size + 1; j <= i * size; ++j) {
            belong[j] = i;
        }
    for(int i = 1; i <= n; ++i){
        scanf("%d",&aa[i]);
        aa[i]^=aa[i-1];
    }
    for(int i = 1; i <= m; ++i) {
        scanf("%d %d",&q[i].l,&q[i].r);
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    if(k!=0) cnt[0]=1;
    for(int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while(l<ql){
            now-=cnt[aa[l-1]^k];
            cnt[aa[l-1]]--;
            l++;
        }
        while(l>ql){
            l--;
            cnt[aa[l-1]]++;
            now+=cnt[aa[l-1]^k];
        }
        while(r>qr){
            now-=cnt[aa[r]^k];
            cnt[aa[r]]--;
            r--;
        }
        while(r<qr){
            r++;
            cnt[aa[r]]++;
            now+=cnt[aa[r]^k];
        }
        ans[q[i].id] = now;
    }
    for(int i = 1; i <= m; ++i) {
        cout<<ans[i]<<endl;
    }
    return 0;
}


/* Author haleyk10198 */
/* �@��:  haleyk10198 */
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <string>
#include <set>
#include <stack>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))

using namespace std;

pair<pii,int> in[1000010];
ll out[1000010];
int cnt[1000010];
ll now;
int a[1000010],ps[1000010];
int n,m,k,sqrtn;

struct MO{
	bool operator()(pair<pii,int> x,pair<pii,int> y){
		pii a=x.first,b=y.first;
		return (a.first/sqrtn<b.first/sqrtn)||(a.first/sqrtn==b.first/sqrtn&&a.second<b.second);
	}
};

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin>>n>>m>>k;
	sqrtn=sqrt(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<m;i++){
		cin>>in[i].first.first>>in[i].first.second;
		in[i].second=i;
	}
	sort(in,in+m,MO());
	for(int i=1;i<=n;i++)
		ps[i]=ps[i-1]^a[i-1];
	for(int i=0,l=0,r=0;i<m;i++){
		int u=in[i].first.first,v=in[i].first.second+1;
		for(;r<v;){
			now+=cnt[k^ps[r]];
			cnt[ps[r++]]++;
		}
		for(;r>v;){
			cnt[ps[--r]]--;
			now-=cnt[k^ps[r]];
		}
		for(;l+1<u;){
			cnt[ps[l]]--;
			now-=cnt[k^ps[l++]];
		}
		for(;l+1>u;){
			now+=cnt[k^ps[--l]];
			cnt[ps[l]]++;
		}
		out[in[i].second]=now;
	}
	for(int i=0;i<m;i++)
		cout<<out[i]<<endl;
	return 0;
}


/* Author haleyk10198 */
/* �@��:  haleyk10198 */
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <string>
#include <set>
#include <stack>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))

using namespace std;

pair<pii,int> in[100010];
int out[100010];
int cnt[1000010],now;
int a[100010],ps[100010];
int n,m,k,sqrtn;

struct MO{
	bool operator()(pair<pii,int> x,pair<pii,int> y){
		pii a=x.first,b=y.first;
		return (a.first/sqrtn<b.first/sqrtn)||(a.first/sqrtn==b.first/sqrtn&&a.second<b.second);
	}
};

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin>>n>>m>>k;
	sqrtn=sqrt(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<m;i++){
		cin>>in[i].first.first>>in[i].first.second;
		in[i].second=i;
	}
	sort(in,in+m,MO());
	for(int i=1;i<=n;i++)
		ps[i]=ps[i-1]^a[i-1];
	for(int i=0,l=0,r=0;i<m;i++){
		int u=in[i].first.first,v=in[i].first.second+1;
		for(;r<v;){
			now+=cnt[k^ps[r]];
			cnt[ps[r++]]++;
		}
		for(;r>v;){
			cnt[ps[--r]]--;
			now-=cnt[k^ps[r]];
		}
		for(;l+1<u;){
			cnt[ps[l]]--;
			now-=cnt[k^ps[l++]];
		}
		for(;l+1>u;){
			now+=cnt[k^ps[--l]];
			cnt[ps[l]]++;
		}
		out[in[i].second]=now;
	}
	for(int i=0;i<m;i++)
		cout<<out[i]<<endl;
	return 0;
}


/* Author haleyk10198 */
/* �@��:  haleyk10198 */
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <string>
#include <set>
#include <stack>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))

using namespace std;

pair<pii,int> in[100010];
int out[100010];
int cnt[1000010],now;
int a[100010],ps[100010];
int n,m,k,sqrtn;

struct MO{
	bool operator()(pair<pii,int> x,pair<pii,int> y){
		pii a=x.first,b=y.first;
		return (a.first/sqrtn<b.first/sqrtn)||(a.first/sqrtn==b.first/sqrtn&&a.second<b.second);
	}
};

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin>>n>>m>>k;
	sqrtn=sqrt(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<m;i++){
		cin>>in[i].first.first>>in[i].first.second;
		in[i].second=i;
	}
	sort(in,in+m,MO());
	for(int i=1;i<=n;i++)
		ps[i]=ps[i-1]^a[i-1];
	for(int i=0,l=0,r=0;i<m;i++){
		int u=in[i].first.first,v=in[i].first.second+1;
		for(;r<v;){
			cnt[ps[r]]++;
			now+=cnt[k^ps[r++]];
		}
		for(;r>v;){
			cnt[ps[--r]]--;
			now-=cnt[k^ps[r]];
		}
		for(;l+1<u;){
			cnt[ps[l]]--;
			now-=cnt[k^ps[l++]];
		}
		for(;l+1>u;){
			cnt[ps[--l]]++;
			now+=cnt[k^ps[l]];
		}
		out[in[i].second]=now;
	}
	for(int i=0;i<m;i++)
		cout<<out[i]<<endl;
	return 0;
}


/* Author haleyk10198 */
/* �@��:  haleyk10198 */
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <string>
#include <set>
#include <stack>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))

using namespace std;

pair<pii,int> in[100010];
int out[100010];
int cnt[1000010],now;
int a[100010],ps[100010];
int n,m,k,sqrtn;

struct MO{
	bool operator()(pair<pii,int> x,pair<pii,int> y){
		pii a=x.first,b=y.first;
		return (a.first/sqrtn<b.first/sqrtn)||(a.first/sqrtn==b.first/sqrtn&&a.second<b.second);
	}
};

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin>>n>>m>>k;
	sqrtn=sqrt(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<m;i++){
		cin>>in[i].first.first>>in[i].first.second;
		in[i].second=i;
	}
	sort(in,in+m,MO());
	for(int i=1;i<=n;i++)
		ps[i]=ps[i-1]^a[i-1];
	for(int i=0,l=-1,r=0;i<m;i++){
		int u=in[i].first.first-1,v=in[i].first.second+1;
		for(;r<v;){
			cnt[ps[r]]++;
			now+=cnt[k^ps[r++]];
		}
		for(;r>v;){
			cnt[ps[--r]]--;
			now-=cnt[k^ps[r]];
		}
		for(;l+1<u;){
			cnt[ps[++l]]--;
			now-=cnt[k^ps[l]];
		}
		for(;l+1>u;){
			cnt[ps[l]]++;
			now+=cnt[k^ps[l--]];
		}
		out[in[i].second]=now;
	}
	for(int i=0;i<m;i++)
		cout<<out[i]<<endl;
	return 0;
}


/* Author haleyk10198 */
/* �@��:  haleyk10198 */
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <string>
#include <set>
#include <stack>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))

using namespace std;

pair<pii,int> in[1000010];
ll out[1000010],cnt[1100000];
ll now;
int a[1000010],ps[1000010];
int n,m,k,sqrtn;

struct MO{
	bool operator()(pair<pii,int> x,pair<pii,int> y){
		pii a=x.first,b=y.first;
		return (a.first/sqrtn<b.first/sqrtn)||(a.first/sqrtn==b.first/sqrtn&&a.second<b.second);
	}
};

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin>>n>>m>>k;
	sqrtn=sqrt(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<m;i++){
		cin>>in[i].first.first>>in[i].first.second;
		in[i].second=i;
	}
	sort(in,in+m,MO());
	for(int i=1;i<=n;i++)
		ps[i]=ps[i-1]^a[i-1];
	for(int i=0,l=0,r=0;i<m;i++){
		int u=in[i].first.first,v=in[i].first.second+1;
		for(;r<v;){
			now+=cnt[k^ps[r]];
			cnt[ps[r++]]++;
		}
		for(;r>v;){
			cnt[ps[--r]]--;
			now-=cnt[k^ps[r]];
		}
		for(;l+1<u;){
			cnt[ps[l]]--;
			now-=cnt[k^ps[l++]];
		}
		for(;l+1>u;){
			now+=cnt[k^ps[--l]];
			cnt[ps[l]]++;
		}
		out[in[i].second]=now;
	}
	for(int i=0;i<m;i++)
		cout<<out[i]<<endl;
	return 0;
}


/* Author haleyk10198 */
/* �@��:  haleyk10198 */
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <string>
#include <set>
#include <stack>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))

using namespace std;

pair<pii,int> in[100010];
ll out[100010],cnt[1000010];
ll now;
int a[100010],ps[100010];
int n,m,k,sqrtn;

struct MO{
	bool operator()(pair<pii,int> x,pair<pii,int> y){
		pii a=x.first,b=y.first;
		return (a.first/sqrtn<b.first/sqrtn)||(a.first/sqrtn==b.first/sqrtn&&a.second<b.second);
	}
};

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin>>n>>m>>k;
	sqrtn=sqrt(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<m;i++){
		cin>>in[i].first.first>>in[i].first.second;
		in[i].second=i;
	}
	sort(in,in+m,MO());
	for(int i=1;i<=n;i++)
		ps[i]=ps[i-1]^a[i-1];
	for(int i=0,l=0,r=0;i<m;i++){
		int u=in[i].first.first,v=in[i].first.second+1;
		for(;r<v;){
			now+=cnt[k^ps[r]];
			cnt[ps[r++]]++;
		}
		for(;r>v;){
			cnt[ps[--r]]--;
			now-=cnt[k^ps[r]];
		}
		for(;l+1<u;){
			cnt[ps[l]]--;
			now-=cnt[k^ps[l++]];
		}
		for(;l+1>u;){
			now+=cnt[k^ps[--l]];
			cnt[ps[l]]++;
		}
		out[in[i].second]=now;
	}
	for(int i=0;i<m;i++)
		cout<<out[i]<<endl;
	return 0;
}


/* Author haleyk10198 */
/* �@��:  haleyk10198 */
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <string>
#include <set>
#include <stack>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))

using namespace std;

pair<pii,int> in[100010];
int out[100010];
int cnt[1000010],now;
int a[100010],ps[100010];
int n,m,k,sqrtn;

struct MO{
	bool operator()(pair<pii,int> x,pair<pii,int> y){
		pii a=x.first,b=y.first;
		return (a.first/sqrtn<b.first/sqrtn)||(a.first/sqrtn==b.first/sqrtn&&a.second<b.second);
	}
};

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin>>n>>m>>k;
	sqrtn=sqrt(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<m;i++){
		cin>>in[i].first.first>>in[i].first.second;
		in[i].second=i;
	}
	sort(in,in+m,MO());
	for(int i=1;i<=n;i++)
		ps[i]=ps[i-1]^a[i-1];
	for(int i=0,l=-1,r=0;i<m;i++){
		int u=in[i].first.first-1,v=in[i].first.second+1;
		for(;r<v;){
			cnt[ps[r]]++;
			now+=cnt[k^ps[r++]];
		}
		for(;r>v;){
			cnt[ps[--r]]--;
			now-=cnt[k^ps[r]];
		}
		for(;l+1<u;){
			cnt[ps[++l]]--;
			now-=cnt[k^ps[l]];
		}
		for(;l+1>u;){
			cnt[ps[l--]]++;
			now+=cnt[k^ps[l]];
		}
		out[in[i].second]=now;
	}
	for(int i=0;i<m;i++)
		cout<<out[i]<<endl;
	return 0;
}


/* Author haleyk10198 */
/* �@��:  haleyk10198 */
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <string>
#include <set>
#include <stack>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))

using namespace std;

pair<pii,int> in[100010];
int out[100010];
int cnt[1000010],now;
int a[100010],ps[100010];
int n,m,k,sqrtn;

struct MO{
	bool operator()(pair<pii,int> x,pair<pii,int> y){
		pii a=x.first,b=y.first;
		return (a.first/sqrtn<b.first/sqrtn)||(a.first/sqrtn==b.first/sqrtn&&a.second<b.second);
	}
};

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin>>n>>m>>k;
	sqrtn=sqrt(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<m;i++){
		cin>>in[i].first.first>>in[i].first.second;
		in[i].second=i;
	}
	sort(in,in+m,MO());
	for(int i=1;i<=n;i++)
		ps[i]=ps[i-1]^a[i-1];
	cnt[0]=1;
	for(int i=0,l=0,r=0;i<m;i++){
		int u=in[i].first.first,v=in[i].first.second;
		for(;r<v;){
			cnt[ps[++r]]++;
			now+=cnt[k^ps[r]];
		}
		for(;r>v;r--){
			cnt[ps[r]]--;
			now-=cnt[k^ps[r--]];
		}
		for(;l+1<u;){
			cnt[ps[l]]--;
			now-=cnt[k^ps[l++]];
		}
		for(;l+1>u;){
			cnt[ps[--l]]++;
			now+=cnt[k^ps[l]];
		}
		out[in[i].second]=now;
	}
	for(int i=0;i<m;i++)
		cout<<out[i]<<endl;
	return 0;
}


/* Author haleyk10198 */
/* �@��:  haleyk10198 */
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <string>
#include <set>
#include <stack>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))

using namespace std;

pair<pii,int> in[100010];
ll out[100010];
int cnt[1000010];
ll now;
int a[100010],ps[100010];
int n,m,k,sqrtn;

struct MO{
	bool operator()(pair<pii,int> x,pair<pii,int> y){
		pii a=x.first,b=y.first;
		return (a.first/sqrtn<b.first/sqrtn)||(a.first/sqrtn==b.first/sqrtn&&a.second<b.second);
	}
};

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin>>n>>m>>k;
	sqrtn=sqrt(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<m;i++){
		cin>>in[i].first.first>>in[i].first.second;
		in[i].second=i;
	}
	sort(in,in+m,MO());
	for(int i=1;i<=n;i++)
		ps[i]=ps[i-1]^a[i-1];
	for(int i=0,l=0,r=0;i<m;i++){
		int u=in[i].first.first,v=in[i].first.second+1;
		for(;r<v;){
			now+=cnt[k^ps[r]];
			cnt[ps[r++]]++;
		}
		for(;r>v;){
			cnt[ps[--r]]--;
			now-=cnt[k^ps[r]];
		}
		for(;l+1<u;){
			cnt[ps[l]]--;
			now-=cnt[k^ps[l++]];
		}
		for(;l+1>u;){
			now+=cnt[k^ps[--l]];
			cnt[ps[l]]++;
		}
		out[in[i].second]=now;
	}
	for(int i=0;i<m;i++)
		cout<<out[i]<<endl;
	return 0;
}


/* Author haleyk10198 */
/* �@��:  haleyk10198 */
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <string>
#include <set>
#include <stack>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))

using namespace std;

pair<pii,int> in[1000010];
ll out[1000010],cnt[1000010];
ll now;
int a[1000010],ps[1000010];
int n,m,k,sqrtn;

struct MO{
	bool operator()(pair<pii,int> x,pair<pii,int> y){
		pii a=x.first,b=y.first;
		return (a.first/sqrtn<b.first/sqrtn)||(a.first/sqrtn==b.first/sqrtn&&a.second<b.second);
	}
};

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin>>n>>m>>k;
	sqrtn=sqrt(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<m;i++){
		cin>>in[i].first.first>>in[i].first.second;
		in[i].second=i;
	}
	sort(in,in+m,MO());
	for(int i=1;i<=n;i++)
		ps[i]=ps[i-1]^a[i-1];
	for(int i=0,l=0,r=0;i<m;i++){
		int u=in[i].first.first,v=in[i].first.second+1;
		for(;r<v;){
			now+=cnt[k^ps[r]];
			cnt[ps[r++]]++;
		}
		for(;r>v;){
			cnt[ps[--r]]--;
			now-=cnt[k^ps[r]];
		}
		for(;l+1<u;){
			cnt[ps[l]]--;
			now-=cnt[k^ps[l++]];
		}
		for(;l+1>u;){
			now+=cnt[k^ps[--l]];
			cnt[ps[l]]++;
		}
		out[in[i].second]=now;
	}
	for(int i=0;i<m;i++)
		cout<<out[i]<<endl;
	return 0;
}


/* Author haleyk10198 */
/* �@��:  haleyk10198 */
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <string>
#include <set>
#include <stack>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))

using namespace std;

pair<pii,int> in[100010];
int out[100010];
int cnt[1000010],now;
int a[100010],ps[100010];
int n,m,k,sqrtn;

struct MO{
	bool operator()(pair<pii,int> x,pair<pii,int> y){
		pii a=x.first,b=y.first;
		return (a.first/sqrtn<b.first/sqrtn)||(a.first/sqrtn==b.first/sqrtn&&a.second<b.second);
	}
};

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin>>n>>m>>k;
	sqrtn=sqrt(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<m;i++){
		cin>>in[i].first.first>>in[i].first.second;
		in[i].second=i;
	}
	sort(in,in+m,MO());
	for(int i=1;i<=n;i++)
		ps[i]=ps[i-1]^a[i-1];
	for(int i=0,l=0,r=0;i<m;i++){
		int u=in[i].first.first,v=in[i].first.second+1;
		for(;r<v;){
			cnt[ps[r]]++;
			now+=cnt[k^ps[r++]];
		}
		for(;r>v;r--){
			cnt[ps[--r]]--;
			now-=cnt[k^ps[r]];
		}
		for(;l+1<u;){
			cnt[ps[l]]--;
			now-=cnt[k^ps[l++]];
		}
		for(;l+1>u;){
			cnt[ps[--l]]++;
			now+=cnt[k^ps[l]];
		}
		out[in[i].second]=now;
	}
	for(int i=0;i<m;i++)
		cout<<out[i]<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
 int a[100005];
 int p[100005];
ll int pc[320][100005];
 int n;
 int k;
 int h[1<<20];
vector<int> v[1<<20];
 int tb;
 int bs;
void compute()
{
     int i;
     int j;
     int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;
            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     int q;
     int i;
     int s;
     int l;
     int r;

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        scanf("%d",&a[i]);
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
        //cout<<i<<' '<<p[i]<<endl;
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     ll int cnt;
    while(q--) {
        scanf("%d%d",&l,&r);
        r++;
        int cb = ceil((double)l/bs);
        cnt = pc[cb+1][r];
        //cout<<l<<' '<<cb*bs+1<<endl;
        for(i = l; i < cb*bs+1 && i <= r; i++) {
            int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<i <<' '<<ub2-ub1<<endl;
            cnt += (ll)(ub2-ub1);

        }
        printf("%lld\n",cnt);
    }

}


#include <bits/stdc++.h>
using namespace std;
int a[100005];
long long int p[100005];
struct node
{
    int l;
    int r;
    int pos;
};
node qs[100005];
long long int ans[100005];
long long int h[1<<20];
int n;
long long int sum;
int len;
int compare(struct node a,struct node b)
{
    int x = a.l/len;
    int y = b.l/len;
    if(x == y) {
        return a.r < b.r;
    }
    else {
        return x < y;
    }
}
int k;
void insert(int pos)
{
    h[p[pos]]++;
    sum += h[p[pos]^k];
}
void remove(int pos)
{
    h[p[pos]]--;
    sum -= h[p[pos]^k];
}
int main()
{
    int q;
    int cl = 0;
    int cr = 0;
    int i;

    std::ios::sync_with_stdio(false);
    cin>>n>>q>>k;
    n = n+1;
    len = sqrt(n);
    for(i = 2; i <= n; i++) {
        cin>>a[i];
    }
    sum = 0;
    p[1] = 0;
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1]^a[i];
    }
    for(i = 1; i <= q; i++) {
        cin>>qs[i].l>>qs[i].r;
        qs[i].l;
        qs[i].r++;
        qs[i].pos = i;
    }
    sort(qs+1,qs+q+1,compare);
    for(i = 1; i <= q; i++) {
       while(qs[i].l < cl) {
            insert(cl-1);
            cl--;
        }
        while(qs[i].l > cl) {
            remove(cl);
            cl++;
        }
        while(qs[i].r <= cr+1) {
            remove(cr-1);
            cr--;
        }
        while(qs[i].r >= cr) {
            insert(cr);
            cr++;
        }
        ans[qs[i].pos] = sum;
    }
    for(i = 1; i <= q; i++) {
        cout<<ans[i]<<endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
int a[100005];
long long int p[100005];
struct node
{
    int l;
    int r;
    int pos;
};
node qs[100005];
long long int ans[100005];
long long int h[1<<20];
int n;
long long int sum;
int len;
int compare(struct node a,struct node b)
{
    int x = a.l/len;
    int y = b.l/len;
    if(x == y) {
        return a.r < b.r;
    }
    else {
        return x < y;
    }
}
int k;
void insert(int pos)
{
    h[p[pos]]++;
    sum += h[p[pos]^k];
}
void remove(int pos)
{
    h[p[pos]]--;
    sum -= h[p[pos]^k];
}
int main()
{
    int q;
    int cl = 0;
    int cr = 0;
    int i;

    std::ios::sync_with_stdio(false);
    cin>>n>>q>>k;
    len = sqrt(n);
    n = n+1;
    for(i = 2; i <= n; i++) {
        cin>>a[i];
    }
    sum = 0;
    p[1] = 0;
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1]^a[i];
    }
    for(i = 1; i <= q; i++) {
        cin>>qs[i].l>>qs[i].r;
        qs[i].l;
        qs[i].r++;
        qs[i].pos = i;
    }
    sort(qs+1,qs+q+1,compare);
    for(i = 1; i <= q; i++) {
        while(qs[i].l < cl) {
            insert(cl-1);
            cl--;
        }
        while(qs[i].l > cl) {
            remove(cl);
            cl++;
        }
        while(qs[i].r+1 <= cr) {
            remove(cr-1);
            cr--;
        }
        while(qs[i].r >= cr) {
            insert(cr);
            cr++;
        }
        ans[qs[i].pos] = sum;
    }
    for(i = 1; i <= q; i++) {
        cout<<ans[i]<<endl;
    }
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
 int a[100005];
 int p[100005];
int pc[320][100005];
 int n;
 int k;
 int h[10000006];
vector<int> v[1000006];
 int tb;
 int bs;
void compute()
{
     int i;
     int j;
     int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;
            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     int q;
     int i;
     int s;
     int l;
     int r;

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        scanf("%d",&a[i]);
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
        //cout<<i<<' '<<p[i]<<endl;
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     int cnt;
    while(q--) {
        scanf("%d%d",&l,&r);
        r++;
        int cb = ceil((double)l/bs);
        cnt = pc[cb+1][r];
        //cout<<l<<' '<<cb*bs+1<<endl;
        for(i = l; i < cb*bs+1 && i <= r; i++) {
            int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<i <<' '<<ub2-ub1<<endl;
            cnt += (ub2-ub1);

        }
        printf("%d\n",cnt);
    }

}


#include <bits/stdc++.h>
#define ll unsigned long long
using namespace std;
ll int a[100005];
ll int p[100005];
ll pc[320][100005];
ll int n;
ll int k;
ll int h[1<<20];
vector<ll int> v[1<<20];
 ll int tb;
 ll int bs;
void compute()
{
     ll int i;
     ll int j;
     ll int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;

            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     ll int q;
     ll int i;
     ll int s;
     ll int l;
     ll int r;
     std::ios::sync_with_stdio(false);

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        cin>>a[i];
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
        //cout<<i<<' '<<p[i]<<endl;
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     ll int cnt;
    while(q--) {
        cin>>l>>r;
        r++;
        ll int cb = ceil((double)l/bs);
        cnt = pc[cb+1][r];
        //cout<<l<<' '<<cb*bs+1<<endl;
        for(i = l; i < cb*bs+1 && i <= r; i++) {
            ll int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<i <<' '<<ub2-ub1<<endl;
            cnt += (ll)(ub2-ub1);

        }
        cout<<cnt<<endl;
    }

}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[100005];
int p[100005];
int pc[320][100005];
int n;
int k;
int h[1<<20];
vector<int> v[1<<20];
 int tb;
 int bs;
void compute()
{
     int i;
     int j;
     int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;
            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     int q;
     int i;
     int s;
     int l;
     int r;

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        scanf("%d",&a[i]);
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
        //cout<<i<<' '<<p[i]<<endl;
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     ll int cnt;
    while(q--) {
        scanf("%d%d",&l,&r);
        r++;
        int cb = ceil((double)l/bs);
        cnt = (ll)pc[cb+1][r];
        //cout<<l<<' '<<cb*bs+1<<endl;
        for(i = l; i < cb*bs+1 && i <= r; i++) {
            int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<i <<' '<<ub2-ub1<<endl;
            cnt += (ll)(ub2-ub1);

        }
        printf("%lld\n",cnt);
    }

}


#include <bits/stdc++.h>
#define ll unsigned
using namespace std;
ll int a[100005];
ll int p[100005];
long int pc[320][100005];
ll int n;
ll int k;
ll int h[1<<20];
vector<ll int> v[1<<20];
 ll int tb;
 ll int bs;
void compute()
{
     ll int i;
     ll int j;
     ll int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;

            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     ll int q;
     ll int i;
     ll int s;
     ll int l;
     ll int r;
     std::ios::sync_with_stdio(false);

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        cin>>a[i];
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
        //cout<<i<<' '<<p[i]<<endl;
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     ll int cnt;
    while(q--) {
        cin>>l>>r;
        r++;
        ll int cb = ceil((double)l/bs);
        cnt = pc[cb+1][r];
        //cout<<l<<' '<<cb*bs+1<<endl;
        for(i = l; i < cb*bs+1 && i <= r; i++) {
            ll int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<i <<' '<<ub2-ub1<<endl;
            cnt += (ll)(ub2-ub1);

        }
        cout<<cnt<<endl;
    }

}


#include <bits/stdc++.h>
using namespace std;
int a[100005];
long long int p[100005];
struct node
{
    int l;
    int r;
    int pos;
};
node qs[100005];
long long int ans[100005];
long long int h[1<<20];
int n;
long long int sum;
int len;
int compare(struct node a,struct node b)
{
    int x = a.l/len;
    int y = b.l/len;
    if(x == y) {
        return a.r < b.r;
    }
    else {
        return x < y;
    }
}
int k;
void insert(int pos)
{
    h[p[pos]]++;
    sum += h[p[pos]^k];
}
void remove(int pos)
{
    h[p[pos]]--;
    sum -= h[p[pos]^k];
}
int main()
{
    int q;
    int cl = 1;
    int cr = 1;
    int i;

    std::ios::sync_with_stdio(false);
    cin>>n>>q>>k;
    n = n+1;
    len = sqrt(n);
    for(i = 2; i <= n; i++) {
        cin>>a[i];
    }
    sum = 0;
    p[1] = 0;
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1]^a[i];
    }
    for(i = 1; i <= q; i++) {
        cin>>qs[i].l>>qs[i].r;
        qs[i].l;
        qs[i].r++;
        qs[i].pos = i;
    }
    sort(qs+1,qs+q+1,compare);
    for(i = 1; i <= q; i++) {
       while(qs[i].l < cl) {
            insert(cl-1);
            cl--;
        }
        while(qs[i].l > cl) {
            remove(cl);
            cl++;
        }
        while(qs[i].r <= cr+1) {
            remove(cr-1);
            cr--;
        }
        while(qs[i].r >= cr) {
            insert(cr);
            cr++;
        }
        ans[qs[i].pos] = sum;
    }
    for(i = 1; i <= q; i++) {
        cout<<ans[i]<<endl;
    }
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[100005];
int p[100005];
long int pc[320][100005];
int n;
int k;
int h[1<<20];
vector<int> v[1<<20];
 int tb;
 int bs;
void compute()
{
     int i;
     int j;
     int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;

            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     int q;
     int i;
     int s;
     int l;
     int r;

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        scanf("%d",&a[i]);
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
        //cout<<i<<' '<<p[i]<<endl;
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     ll int cnt;
    while(q--) {
        scanf("%d%d",&l,&r);
        r++;
        int cb = ceil((double)l/bs);
        cnt = pc[cb+1][r];
        //cout<<l<<' '<<cb*bs+1<<endl;
        for(i = l; i < cb*bs+1 && i <= r; i++) {
            int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<i <<' '<<ub2-ub1<<endl;
            cnt += (ll)(ub2-ub1);

        }
        printf("%lld\n",cnt);
    }

}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[100005];
int p[100005];
ll int pc[316][100001];
int n;
int k;
int h[1<<20];
vector<int> v[1<<20];
 int tb;
 int bs;
void compute()
{
     int i;
     int j;
     int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;
            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     int q;
     int i;
     int s;
     int l;
     int r;

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        scanf("%d",&a[i]);
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
        //cout<<i<<' '<<p[i]<<endl;
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     ll int cnt;
    while(q--) {
        scanf("%d%d",&l,&r);
        r++;
        int cb = ceil((double)l/bs);
        cnt = (ll)pc[cb+1][r];
        //cout<<l<<' '<<cb*bs+1<<endl;
        for(i = l; i < cb*bs+1 && i <= r; i++) {
            int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<i <<' '<<ub2-ub1<<endl;
            cnt += (ll)(ub2-ub1);

        }
        printf("%lld\n",cnt);
    }

}


#include <bits/stdc++.h>
#define ll long
using namespace std;
ll int a[100005];
ll int p[100005];
long int pc[320][100005];
ll int n;
ll int k;
ll int h[1<<20];
vector<ll int> v[1<<20];
 ll int tb;
 ll int bs;
void compute()
{
     ll int i;
     ll int j;
     ll int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;

            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     ll int q;
     ll int i;
     ll int s;
     ll int l;
     ll int r;
     std::ios::sync_with_stdio(false);

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        cin>>a[i];
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
        //cout<<i<<' '<<p[i]<<endl;
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     ll int cnt;
    while(q--) {
        cin>>l>>r;
        r++;
        ll int cb = ceil((double)l/bs);
        cnt = pc[cb+1][r];
        //cout<<l<<' '<<cb*bs+1<<endl;
        for(i = l; i < cb*bs+1 && i <= r; i++) {
            ll int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<i <<' '<<ub2-ub1<<endl;
            cnt += (ll)(ub2-ub1);

        }
        cout<<cnt<<endl;
    }

}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
 int a[100005];
 int p[100005];
int pc[320][100005];
 int n;
 int k;
 int h[1<<20];
vector<int> v[1<<20];
 int tb;
 int bs;
void compute()
{
     int i;
     int j;
     int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;
            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     int q;
     int i;
     int s;
     int l;
     int r;

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        scanf("%d",&a[i]);
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
        //cout<<i<<' '<<p[i]<<endl;
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     int cnt;
    while(q--) {
        scanf("%d%d",&l,&r);
        r++;
        int cb = ceil((double)l/bs);
        cnt = pc[cb+1][r];
        //cout<<l<<' '<<cb*bs+1<<endl;
        for(i = l; i < cb*bs+1 && i <= r; i++) {
            int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<i <<' '<<ub2-ub1<<endl;
            cnt += (ub2-ub1);

        }
        printf("%d\n",cnt);
    }

}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[100005];
int p[100005];
vector<ll int> pc[320];
int n;
int k;
int h[1<<20];
vector<int> v[1<<20];
 int tb;
 int bs;
void compute()
{
     int i;
     int j;
     int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = 0; j < (i-1)*bs+1; j++) {
            pc[i].push_back(0);
        }
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i].push_back(cnt);
            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     int q;
     int i;
     int s;
     int l;
     int r;

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        scanf("%d",&a[i]);
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
        //cout<<i<<' '<<p[i]<<endl;
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     ll int cnt;
    while(q--) {
        scanf("%d%d",&l,&r);
        r++;
        int cb = ceil((double)l/bs);
        cnt = pc[cb+1][r];
        //cout<<l<<' '<<cb*bs+1<<endl;
        for(i = l; i < cb*bs+1 && i <= r; i++) {
            int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<i <<' '<<ub2-ub1<<endl;
            cnt += (ll)(ub2-ub1);

        }
        printf("%lld\n",cnt);
    }

}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
 int a[100005];
 int p[100005];
int pc[320][100005];
 int n;
 int k;
 int h[1000006];
vector<int> v[1000006];
 int tb;
 int bs;
void compute()
{
     int i;
     int j;
     int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;
            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     int q;
     int i;
     int s;
     int l;
     int r;

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        scanf("%d",&a[i]);
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
        //cout<<i<<' '<<p[i]<<endl;
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     int cnt;
    while(q--) {
        scanf("%d%d",&l,&r);
        r++;
        int cb = ceil((double)l/bs);
        cnt = pc[cb+1][r];
        //cout<<l<<' '<<cb*bs+1<<endl;
        for(i = l; i < cb*bs+1 && i <= r; i++) {
            int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<i <<' '<<ub2-ub1<<endl;
            cnt += (ub2-ub1);

        }
        printf("%d\n",cnt);
    }

}


#include <bits/stdc++.h>
using namespace std;
int a[100005];
long long int p[100005];
struct node
{
    int l;
    int r;
    int pos;
};
node qs[100005];
long long int ans[100005];
long long int h[1<<20];
int n;
long long int sum;
int len;
int compare(struct node a,struct node b)
{
    int x = a.l/len;
    int y = b.l/len;
    if(x == y) {
        return a.r < b.r;
    }
    else {
        return x < y;
    }
}
int k;
void insert(int pos)
{
    //cout<<"insert"<<' '<<pos<<endl;

    sum += h[p[pos]^k];
    h[p[pos]]++;
    //cout<<sum<<endl;
}
void remove(int pos)
{
    //cout<<"delete"<<' '<<pos<<endl;
    h[p[pos]]--;
    sum -= h[p[pos]^k];
    //cout<<sum<<endl;
}
int main()
{
    int q;
    int cl = 1;
    int cr = 1;
    int i;

    std::ios::sync_with_stdio(false);
    cin>>n>>q>>k;
    n = n+1;
    len = sqrt(n);
    for(i = 2; i <= n; i++) {
        cin>>a[i];
    }
    sum = 0;
    p[1] = 0;
    p[0] = 0;
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1]^a[i];
    }
    for(i = 1; i <= q; i++) {
        cin>>qs[i].l>>qs[i].r;
        qs[i].l;
        qs[i].r++;
        qs[i].pos = i;
    }
    sort(qs+1,qs+q+1,compare);
    h[p[cl]]++;
    for(i = 1; i <= q; i++) {
        while(cl > qs[i].l) {
            cl--;
            insert(cl);
        }
        while(cl < qs[i].l) {
            remove(cl);
            cl++;
        }
        while(cr > qs[i].r) {
            remove(cr);
            cr--;
        }
        while(cr < qs[i].r) {
            cr++;
            insert(cr);
        }
        ans[qs[i].pos] = sum;
    }
    for(i = 1; i <= q; i++) {
        cout<<ans[i]<<endl;
    }
}


#include <bits/stdc++.h>
#define ll unsigned
using namespace std;
ll int a[100005];
ll int p[100005];
float pc[320][100005];
ll int n;
ll int k;
ll int h[1<<20];
vector<ll int> v[1<<20];
 ll int tb;
 ll int bs;
void compute()
{
     ll int i;
     ll int j;
     ll int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;

            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     ll int q;
     ll int i;
     ll int s;
     ll int l;
     ll int r;
     std::ios::sync_with_stdio(false);

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        cin>>a[i];
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
        //cout<<i<<' '<<p[i]<<endl;
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     ll int cnt;
    while(q--) {
        cin>>l>>r;
        r++;
        ll int cb = ceil((double)l/bs);
        cnt = pc[cb+1][r];
        //cout<<l<<' '<<cb*bs+1<<endl;
        for(i = l; i < cb*bs+1 && i <= r; i++) {
            ll int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<i <<' '<<ub2-ub1<<endl;
            cnt += (ll)(ub2-ub1);

        }
        cout<<cnt<<endl;
    }

}


#include <bits/stdc++.h>
using namespace std;
int a[100005];
long long int p[100005];
struct node
{
    int l;
    int r;
    int pos;
};
node qs[100005];
long long int ans[100005];
long long int h[1<<20];
int n;
long long int sum;
int len;
int compare(struct node a,struct node b)
{
    int x = a.l/len;
    int y = b.l/len;
    if(x == y) {
        return a.r < b.r;
    }
    else {
        return x < y;
    }
}
int k;
void insert(int pos)
{
    h[p[pos]]++;
    sum += h[p[pos]^k];
}
void remove(int pos)
{
    h[p[pos]]--;
    sum -= h[p[pos]^k];
}
int main()
{
    int q;
    int cl = 0;
    int cr = 0;
    int i;

    std::ios::sync_with_stdio(false);
    cin>>n>>q>>k;
    len = sqrt(n);
    n = n+1;
    for(i = 2; i <= n; i++) {
        cin>>a[i];
    }
    sum = 0;
    p[1] = 0;
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1]^a[i];
    }
    for(i = 1; i <= q; i++) {
        cin>>qs[i].l>>qs[i].r;
        qs[i].l;
        qs[i].r++;
        qs[i].pos = i;
    }
    sort(qs+1,qs+q+1,compare);
    for(i = 1; i <= q; i++) {
       while(qs[i].l < cl) {
            insert(cl-1);
            cl--;
        }
        while(qs[i].l > cl) {
            remove(cl);
            cl++;
        }
        while(qs[i].r <= cr+1) {
            remove(cr-1);
            cr--;
        }
        while(qs[i].r >= cr) {
            insert(cr);
            cr++;
        }
        ans[qs[i].pos] = sum;
    }
    for(i = 1; i <= q; i++) {
        cout<<ans[i]<<endl;
    }
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll int a[100005];
ll int p[100005];
ll int pc[320][100005];
ll int n;
ll int k;
ll int h[1000006];
vector<ll int> v[1000006];
ll int tb;
ll int bs;
void compute()
{
    ll int i;
    ll int j;
    ll int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;
            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
    ll int q;
    ll int i;
    ll int s;
    ll int l;
    ll int r;

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        scanf("%lld",&a[i]);
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
    ll int cnt;
    while(q--) {
        scanf("%lld%lld",&l,&r);
        r++;
        ll int cb = ceil((double)l/bs);
        cnt = pc[cb+1][r];

        for(i = l; i < cb*bs+1 && i <= n; i++) {
            ll int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<ub2-ub1<<endl;
            cnt += (ub2-ub1);

        }
        printf("%lld\n",cnt);
    }

}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
 int a[100005];
 int p[100005];
int pc[320][100005];
 int n;
 int k;
 int h[1000006];
vector<int> v[1000006];
 int tb;
 int bs;
void compute()
{
     int i;
     int j;
     int cnt;

    for(i = 1; i <= tb; i++) {
        memset(h,0,sizeof(h));
        cnt = 0;
        for(j = (i-1)*bs+1; j <= n; j++) {
            cnt = cnt + h[p[j]^k];
            h[p[j]]++;
            pc[i][j] = cnt;
            //cout<<pc[i][j]<<' ';
        }
        //cout<<endl;
    }
}
int main()
{
     int q;
     int i;
     int s;
     int l;
     int r;

    cin>>n>>q>>k;
    n = n+1;
    for(i = 2; i <= n; i++) {
        scanf("%d",&a[i]);
    }
    p[1] = 0;
    v[0].push_back(1);
    for(i = 2; i <= n; i++) {
        p[i] = p[i-1] ^ a[i];
        v[p[i]].push_back(i);
    }
    s = sqrt(n);
    tb = ceil((double)n/s);
    bs = sqrt(n);
    compute();
     int cnt;
    while(q--) {
        scanf("%d%d",&l,&r);
        r++;
         int cb = ceil((double)l/bs);
        cnt = pc[cb+1][r];

        for(i = l; i < cb*bs+1 && i <= n; i++) {
             int x = p[i]^k;
            int ub1 = upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();
            int ub2 = upper_bound(v[x].begin(),v[x].end(),r)-v[x].begin();
            //cout<<ub2-ub1<<endl;
            cnt += (ub2-ub1);

        }
        printf("%d\n",cnt);
    }

}


/* 	Problem: COT2 - Count on a Tree II
	Judge: Spoj
	Link: http://www.spoj.com/problems/COT2/
*/

#include <bits/stdc++.h>
#define fr(a,b,c) for(int (a) = (b); (a) < (c); ++(a))
#define rp(a,b) fr(a,0,b)
#define fre(a, b) for(int a = adj[b]; a != -1; a = ant[a])
#define cl(a,b) memset((a), (b), sizeof(a))
#define sc(a) scanf("%d", &a)
#define sc2(a,b) scanf("%d%d", &a, &b)
#define sc3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define scs(s) scanf(" %s", s)
#define pri(x) printf("%d\n", x)
#define X first
#define Y second
#define mp make_pair
#define pb push_back

using namespace std;
const int inf = 0x3f3f3f3f;
const int minusinf = -inf;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};

typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<vi > vii;
typedef std::pair<int, int> pii;

struct Query{
	int L, R;
	int t;
	int idx;
};

const int mv = 111111;
int K;

ll ans[mv];
int A[mv], L[mv], R[mv], countL[mv], countR[mv], V[mv];
int N, Q, M;

bool comp(Query &a, Query &b){
	if(a.L/M != b.L/M) return a.L/M < b.L/M;
	else return a.R < b.R;
}

Query pergs[mv];

int res;
int xL, xR;

void addr(int p){
	countL[L[p]^A[p]]++;
	countR[R[p]^A[p]]++;
	res+=countL[L[p]^K];
}

void addl(int p){
	countL[L[p]^A[p]]++;
	countR[R[p]^A[p]]++;
	res+=countR[R[p]^K];
}

void removel(int p){
	res-=countR[R[p]^K];
	countL[L[p]^A[p]]--;
	countR[R[p]^A[p]]--;
}

void remover(int p){
	res-=countL[L[p]^K];
	countR[R[p]^A[p]]--;
	countL[L[p]^A[p]]--;
}

int main(){
	sc2(N, Q);
	sc(K);
	M = sqrt(N);
	if(M*M < N) M++;
	rp(i, N){
		sc(A[i]);
	}
	R[N-1] = A[N-1];
	for(int i = N-2; i>=0; --i){
		R[i] = A[i] ^ R[i+1];
	}
	L[0] = A[0];
	for(int i = 1; i<N; ++i){
		L[i] = L[i-1] ^ A[i];
	}
	/*
	rp(i, N){
		printf("%d: %d\n", i, L[i]);
	}
	puts("");
	rp(i, N){
		printf("%d: %d\n", i, R[i]);
	}
	puts("");
	*/
	int a, b;
	rp(i, Q){
		sc2(a,b);
		a--;
		pergs[i].L = a;
		pergs[i].R = b;
		pergs[i].idx = i;
	}
	sort(pergs, pergs+Q, comp);
	int curL = 0, curR = 0;
	res = 0;
	xL = 0;
	xR = 0;
	rp(i, Q){
		int L = pergs[i].L, R = pergs[i].R, idx = pergs[i].idx;
		while(curL > L){
			addl(--curL);
		}
		while(curR < R){
			addr(curR++);
		}
		while(curL < L){
			removel(curL++);
		}
		while(curR > R){
			remover(--curR);
		}
		ans[idx] = res;
	}
	rp(i, Q){
		printf("%I64d\n", ans[i]);
	}
    return 0;
}


/* 	Problem: COT2 - Count on a Tree II
	Judge: Spoj
	Link: http://www.spoj.com/problems/COT2/
*/

#include <bits/stdc++.h>
#define fr(a,b,c) for(int (a) = (b); (a) < (c); ++(a))
#define rp(a,b) fr(a,0,b)
#define fre(a, b) for(int a = adj[b]; a != -1; a = ant[a])
#define cl(a,b) memset((a), (b), sizeof(a))
#define sc(a) scanf("%d", &a)
#define sc2(a,b) scanf("%d%d", &a, &b)
#define sc3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define scs(s) scanf(" %s", s)
#define pri(x) printf("%d\n", x)
#define X first
#define Y second
#define mp make_pair
#define pb push_back

using namespace std;
const int inf = 0x3f3f3f3f;
const int minusinf = -inf;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};

typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<vi > vii;
typedef std::pair<int, int> pii;

struct Query{
	int L, R;
	int t;
	int idx;
};

const int mv = 111111;
const int mt = 5555555;
int K;

ll ans[mv];
int A[mv], L[mv], R[mv];
ll countL[mt], countR[mt];
int N, Q, M;

bool comp(Query &a, Query &b){
	if(a.L/M != b.L/M) return a.L/M < b.L/M;
	else return a.R < b.R;
}

Query pergs[mv];

ll res;

void addr(int p){
	countL[L[p]^A[p]]++;
	countR[R[p]^A[p]]++;
	res+=countL[L[p]^K];
}

void addl(int p){
	countL[L[p]^A[p]]++;
	countR[R[p]^A[p]]++;
	res+=countR[R[p]^K];
}

void removel(int p){
	res-=countR[R[p]^K];
	countL[L[p]^A[p]]--;
	countR[R[p]^A[p]]--;
}

void remover(int p){
	res-=countL[L[p]^K];
	countR[R[p]^A[p]]--;
	countL[L[p]^A[p]]--;
}

int main(){
	sc2(N, Q);
	sc(K);
	M = sqrt(N);
	if(M*M < N) M++;
	rp(i, N){
		sc(A[i]);
	}
	R[N-1] = A[N-1];
	for(int i = N-2; i>=0; --i){
		R[i] = A[i] ^ R[i+1];
	}
	L[0] = A[0];
	for(int i = 1; i<N; ++i){
		L[i] = L[i-1] ^ A[i];
	}
	/*
	rp(i, N){
		printf("%d: %d\n", i, L[i]);
	}
	puts("");
	rp(i, N){
		printf("%d: %d\n", i, R[i]);
	}
	puts("");
	*/
	int a, b;
	rp(i, Q){
		sc2(a,b);
		a--;
		pergs[i].L = a;
		pergs[i].R = b;
		pergs[i].idx = i;
	}
	sort(pergs, pergs+Q, comp);
	int curL = 0, curR = 0;
	res = 0;
	rp(i, Q){
		int L = pergs[i].L, R = pergs[i].R, idx = pergs[i].idx;
		while(curL > L){
			addl(--curL);
		}
		while(curR < R){
			addr(curR++);
		}
		while(curL < L){
			removel(curL++);
		}
		while(curR > R){
			remover(--curR);
		}
		ans[idx] = res;
	}
	rp(i, Q){
		printf("%lld\n", ans[i]);
	}
    return 0;
}


/* 	Problem: COT2 - Count on a Tree II
	Judge: Spoj
	Link: http://www.spoj.com/problems/COT2/
*/

#include <bits/stdc++.h>
#define fr(a,b,c) for(int (a) = (b); (a) < (c); ++(a))
#define rp(a,b) fr(a,0,b)
#define fre(a, b) for(int a = adj[b]; a != -1; a = ant[a])
#define cl(a,b) memset((a), (b), sizeof(a))
#define sc(a) scanf("%d", &a)
#define sc2(a,b) scanf("%d%d", &a, &b)
#define sc3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define scs(s) scanf(" %s", s)
#define pri(x) printf("%d\n", x)
#define X first
#define Y second
#define mp make_pair
#define pb push_back

using namespace std;
const int inf = 0x3f3f3f3f;
const int minusinf = -inf;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};

typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<vi > vii;
typedef std::pair<int, int> pii;

struct Query{
	int L, R;
	int t;
	int idx;
};

const int mv = 111111;
int K;

ll ans[mv];
int A[mv], L[mv], R[mv], countL[2222222], countR[2222222];
int N, Q, M;

bool comp(Query &a, Query &b){
	if(a.L/M != b.L/M) return a.L/M < b.L/M;
	else return a.R < b.R;
}

Query pergs[mv];

int res;
int xL, xR;

void addr(int p){
	countL[L[p]^A[p]]++;
	countR[R[p]^A[p]]++;
	res+=countL[L[p]^K];
}

void addl(int p){
	countL[L[p]^A[p]]++;
	countR[R[p]^A[p]]++;
	res+=countR[R[p]^K];
}

void removel(int p){
	res-=countR[R[p]^K];
	countL[L[p]^A[p]]--;
	countR[R[p]^A[p]]--;
}

void remover(int p){
	res-=countL[L[p]^K];
	countR[R[p]^A[p]]--;
	countL[L[p]^A[p]]--;
}

int main(){
	sc2(N, Q);
	sc(K);
	M = sqrt(N);
	if(M*M < N) M++;
	rp(i, N){
		sc(A[i]);
	}
	R[N-1] = A[N-1];
	for(int i = N-2; i>=0; --i){
		R[i] = A[i] ^ R[i+1];
	}
	L[0] = A[0];
	for(int i = 1; i<N; ++i){
		L[i] = L[i-1] ^ A[i];
	}
	/*
	rp(i, N){
		printf("%d: %d\n", i, L[i]);
	}
	puts("");
	rp(i, N){
		printf("%d: %d\n", i, R[i]);
	}
	puts("");
	*/
	int a, b;
	rp(i, Q){
		sc2(a,b);
		a--;
		pergs[i].L = a;
		pergs[i].R = b;
		pergs[i].idx = i;
	}
	sort(pergs, pergs+Q, comp);
	int curL = 0, curR = 0;
	res = 0;
	xL = 0;
	xR = 0;
	rp(i, Q){
		int L = pergs[i].L, R = pergs[i].R, idx = pergs[i].idx;
		while(curL > L){
			addl(--curL);
		}
		while(curR < R){
			addr(curR++);
		}
		while(curL < L){
			removel(curL++);
		}
		while(curR > R){
			remover(--curR);
		}
		ans[idx] = res;
	}
	rp(i, Q){
		printf("%lld\n", ans[i]);
	}
    return 0;
}