#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int n, m, k;
int tot[10000010];
int block;
struct que
{
    int l, r, ans, id;
}q[1000010];
bool pd1(que i, que j)
{
	return (i.l / block == j.l / block ? i.r < j.r : i.l < j.l);
}
bool pd2(que i, que j)
{
	return (i.id < j.id);
}
int c[500010], ans;
void add(int o)
{
    ans += tot[c[o] ^ k];
    ++ tot[c[o]];
}
void del(int o)
{
    ans -= tot[c[o] ^ k];
    -- tot[c[o]];
}
int main()
{
    scanf("%d%d%d", &n, &m, &k);
    if (sqrt(m * 2 / 3) > 0)
    block = n / sqrt(m * 2 / 3);
    else
    block = 1;
    for (int i = 1; i <= n; ++ i)
    {
        scanf("%d", &c[i]);
        c[i] ^= c[i - 1];
    }
    for (int i = 1; i <= m; ++ i)
    {
        int l, r;
        scanf("%d%d", &l, &r);
        q[i].l = l - 1;
        q[i].r = r;
        q[i].id = i;
    }
    sort(q + 1, q + 1 + m, pd1);
    tot[0] = 1;
    int l = 0, r = 0;
    for (int i = 1; i <= m; ++ i)
    {
        while(l > q[i].l)-- l, add(l);
        while(r > q[i].r)del(r), -- r;
        while(r < q[i].r)++ r, add(r);
        while(l < q[i].l)del(l), ++ l;
        q[i].ans = ans;
    }
    sort(q + 1, q + 1 + m, pd2);
    for (int i = 1; i <= m; ++ i)
    {
        printf("%d\n", q[i].ans);
    }
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int n, m, k;
int tot[1000010];
int block;
struct que
{
    int l, r, ans, id;
}q[100010];
bool pd1(que i, que j)
{
	return (i.l / block == j.l / block ? i.r < j.r : i.l < j.l);
}
bool pd2(que i, que j)
{
	return (i.id < j.id);
}
int c[50010], ans;
void add(int o)
{
    ans += tot[c[o] ^ k];
    ++ tot[c[o]];
}
void del(int o)
{
    -- tot[c[o]];
    ans -= tot[c[o] ^ k];
}
int main()
{
    scanf("%d%d%d", &n, &m, &k);
    block = n / sqrt(m * 2 / 3);
    for (int i = 1; i <= n; ++ i)
    {
        scanf("%d", &c[i]);
        c[i] ^= c[i - 1];
    }
    for (int i = 1; i <= m; ++ i)
    {
        int l, r;
        scanf("%d%d", &l, &r);
        q[i].l = l - 1;
        q[i].r = r;
        q[i].id = i;
    }
    sort(q + 1, q + 1 + m, pd1);
    tot[0] = 1;
    int l = 0, r = 0;
    for (int i = 1; i <= m; ++ i)
    {
        while(l > q[i].l)-- l, add(l);
        while(r > q[i].r)del(r), -- r;
        while(r < q[i].r)++ r, add(r);
        while(l < q[i].l)del(l), ++ l;
        q[i].ans = ans;
    }
    sort(q + 1, q + 1 + m, pd2);
    for (int i = 1; i <= m; ++ i)
    {
        printf("%d\n", q[i].ans);
    }
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int n, m, k;
int tot[1000010];
int block;
struct que
{
    int l, r, ans, id;
}q[100010];
bool pd1(que i, que j)
{
	return (i.l / block == j.l / block ? i.r < j.r : i.l < j.l);
}
bool pd2(que i, que j)
{
	return (i.id < j.id);
}
int c[50010], ans;
void add(int o)
{
    ans += tot[c[o] ^ k];
    ++ tot[c[o]];
}
void del(int o)
{
    -- tot[c[o]];
    ans -= tot[c[o] ^ k];
}
int main()
{
    scanf("%d%d%d", &n, &m, &k);
    if (sqrt(m * 2 / 3) > 0)
    block = n / sqrt(m * 2 / 3);
    else
    block = 1;
    for (int i = 1; i <= n; ++ i)
    {
        scanf("%d", &c[i]);
        c[i] ^= c[i - 1];
    }
    for (int i = 1; i <= m; ++ i)
    {
        int l, r;
        scanf("%d%d", &l, &r);
        q[i].l = l - 1;
        q[i].r = r;
        q[i].id = i;
    }
    sort(q + 1, q + 1 + m, pd1);
    tot[0] = 1;
    int l = 0, r = 0;
    for (int i = 1; i <= m; ++ i)
    {
        while(l > q[i].l)-- l, add(l);
        while(r > q[i].r)del(r), -- r;
        while(r < q[i].r)++ r, add(r);
        while(l < q[i].l)del(l), ++ l;
        q[i].ans = ans;
    }
    sort(q + 1, q + 1 + m, pd2);
    for (int i = 1; i <= m; ++ i)
    {
        printf("%d\n", q[i].ans);
    }
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int n, m, k;
int tot[10000010];
int block;
struct que
{
    int l, r, ans, id;
}q[1000010];
bool pd1(que i, que j)
{
	return (i.l / block == j.l / block ? i.r < j.r : i.l < j.l);
}
bool pd2(que i, que j)
{
	return (i.id < j.id);
}
int c[50010], ans;
void add(int o)
{
    ++ tot[c[o]];
    ans += tot[c[o] ^ k];
}
void del(int o)
{
    -- tot[c[o]];
    ans -= tot[c[o] ^ k];
}
int main()
{
    scanf("%d%d%d", &n, &m, &k);
    if (sqrt(m * 2 / 3) > 0)
    block = n / sqrt(m * 2 / 3);
    else
    block = 1;
    for (int i = 1; i <= n; ++ i)
    {
        scanf("%d", &c[i]);
        c[i] ^= c[i - 1];
    }
    for (int i = 1; i <= m; ++ i)
    {
        int l, r;
        scanf("%d%d", &l, &r);
        q[i].l = l - 1;
        q[i].r = r;
        q[i].id = i;
    }
    sort(q + 1, q + 1 + m, pd1);
    tot[0] = 1;
    int l = 0, r = 0;
    for (int i = 1; i <= m; ++ i)
    {
        while(l > q[i].l)-- l, add(l);
        while(r > q[i].r)del(r), -- r;
        while(r < q[i].r)++ r, add(r);
        while(l < q[i].l)del(l), ++ l;
        q[i].ans = ans;
    }
    sort(q + 1, q + 1 + m, pd2);
    for (int i = 1; i <= m; ++ i)
    {
        printf("%d\n", q[i].ans);
    }
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int n, m, k;
int tot[10000010];
int block;
struct que
{
    int l, r, id;
    long long ans;
}q[1000010];
bool pd1(que i, que j)
{
	return (i.l / block == j.l / block ? i.r < j.r : i.l < j.l);
}
bool pd2(que i, que j)
{
	return (i.id < j.id);
}
long long c[500010], ans;
void add(int o)
{
    ans += tot[c[o] ^ k];
    ++ tot[c[o]];
}
void del(int o)
{
    -- tot[c[o]];
    ans -= tot[c[o] ^ k];
}
int main()
{
    scanf("%d%d%d", &n, &m, &k);
    if (n / sqrt(m * 2 / 3) > 1)
    block = n / sqrt(m * 2 / 3);
    else
    block = 1;
    for (int i = 1; i <= n; ++ i)
    {
        scanf("%d", &c[i]);
        c[i] ^= c[i - 1];
    }
    for (int i = 1; i <= m; ++ i)
    {
        int l, r;
        scanf("%d%d", &l, &r);
        q[i].l = l - 1;
        q[i].r = r;
        q[i].id = i;
    }
    sort(q + 1, q + 1 + m, pd1);
    tot[0] = 1;
    int l = 0, r = 0;
    for (int i = 1; i <= m; ++ i)
    {
        while(l > q[i].l)-- l, add(l);
        while(r > q[i].r)del(r), -- r;
        while(r < q[i].r)++ r, add(r);
        while(l < q[i].l)del(l), ++ l;
        q[i].ans = ans;
    }
    sort(q + 1, q + 1 + m, pd2);
    for (int i = 1; i <= m; ++ i)
    {
        printf("%lld\n", q[i].ans);
    }
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int n, m, k;
int tot[10000010];
int block;
struct que
{
    int l, r, id;
    long long ans;
}q[1000010];
bool pd1(que i, que j)
{
	return (i.l / block == j.l / block ? i.r < j.r : i.l < j.l);
}
bool pd2(que i, que j)
{
	return (i.id < j.id);
}
long long c[500010], ans;
void add(int o)
{
    ans += tot[c[o] ^ k];
    ++ tot[c[o]];
}
void del(int o)
{
    -- tot[c[o]];
    ans -= tot[c[o] ^ k];
}
int main()
{
    scanf("%d%d%d", &n, &m, &k);
    if (n / sqrt(m * 2 / 3) > 0)
    block = n / sqrt(m * 2 / 3);
    else
    block = 1;
    for (int i = 1; i <= n; ++ i)
    {
        scanf("%d", &c[i]);
        c[i] ^= c[i - 1];
    }
    for (int i = 1; i <= m; ++ i)
    {
        int l, r;
        scanf("%d%d", &l, &r);
        q[i].l = l - 1;
        q[i].r = r;
        q[i].id = i;
    }
    sort(q + 1, q + 1 + m, pd1);
    tot[0] = 1;
    int l = 0, r = 0;
    for (int i = 1; i <= m; ++ i)
    {
        while(l > q[i].l)-- l, add(l);
        while(r > q[i].r)del(r), -- r;
        while(r < q[i].r)++ r, add(r);
        while(l < q[i].l)del(l), ++ l;
        q[i].ans = ans;
    }
    sort(q + 1, q + 1 + m, pd2);
    for (int i = 1; i <= m; ++ i)
    {
        printf("%lld\n", q[i].ans);
    }
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int n, m, k;
int tot[50010];
int block;
struct que
{
    int l, r, ans, id;
}q[100010];
bool pd1(que i, que j)
{
	return (i.l / block == j.l / block ? i.r < j.r : i.l < j.l);
}
bool pd2(que i, que j)
{
	return (i.id < j.id);
}
int c[50010], ans;
void add(int o)
{
    ans += tot[c[o] ^ k];
    ++ tot[c[o]];
}
void del(int o)
{
    ans -= tot[c[o] ^ k];
    -- tot[c[o]];
}
int main()
{
    scanf("%d%d%d", &n, &m, &k);
    block = n / sqrt(m * 2 / 3);
    for (int i = 1; i <= n; ++ i)
    {
        scanf("%d", &c[i]);
        c[i] ^= c[i - 1];
    }
    for (int i = 1; i <= m; ++ i)
    {
        int l, r;
        scanf("%d%d", &l, &r);
        q[i].l = l - 1;
        q[i].r = r;
        q[i].id = i;
    }
    sort(q + 1, q + 1 + m, pd1);
    tot[0] = 1;
    int l = 0, r = 0;
    for (int i = 1; i <= m; ++ i)
    {
        while(l > q[i].l)-- l, add(l);
        while(r > q[i].r)del(r), -- r;
        while(r < q[i].r)++ r, add(r);
        while(l < q[i].l)del(l), ++ l;
        q[i].ans = ans;
    }
    sort(q + 1, q + 1 + m, pd2);
    for (int i = 1; i <= m; ++ i)
    {
        printf("%d\n", q[i].ans);
    }
}


#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///prLLInewline
#define getLLI(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(LLI i=1;i<=n;i++)
#define FOR0(i,n)  for(LLI i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(LLI i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (LLI)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long LLI
#define LLI        long long
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

LLI Set(LLI N,LLI pos)
{
    return N=N | (1<<pos);
}
LLI reset(LLI N,LLI pos)
{
    return N= N & ~(1<<pos);
}
bool check(LLI N,LLI pos)
{
    return (bool)(N & (1<<pos));
}
void CI(int &_x)
{
    scanf("%d",&_x);
}

void CO(LLI &_x)
{
    cout<<_x;
}

template<typename T> void getarray(T a[],LLI n)
{
    for(LLI i=0; i<n; i++) cin>>a[i];
}
template<typename T> void prLLIarray(T a[],LLI n)
{
    for(LLI i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const LLI INF=0x7f7f7f7f;

LLI dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
LLI dc8[8]= {0,0,-1,1,1,1,-1,-1};
LLI dr4[4]= {0,0,1,-1};                      ///4 direction move
LLI dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
LLI kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
LLI kn8c[8]= {2,1,-1,-2,-2,-1,1,2};
#define mx 1000000
int n,m,k;
int prefix[mx],ans[mx],cnt[mx];
struct block
{
    int st,ed,inx;
    block() {}
    block(int st,int ed,int inx): st(st),ed(ed),inx(inx) {}
};
bool cmp(block a,block b)
{
    return a.ed<b.ed;

}
int sz=320;
vector<block>V[320];
void read()
{
    CI(n);
    CI(m);
    CI(k);
    FOR1(i,n)
    {
        CI(prefix[i]);

        prefix[i]=prefix[i]^prefix[i-1];

    }

    int l,r;
    FOR0(i,m)
    {

        CI(l);
        CI(r);
        l--,r++;
        V[l/sz].PB(block(l,r,i));
    }

}

void proc()
{
    FOR0(i,sz)sort(ALL(V[i]),cmp);
    int result=0;

    FOR0(i,sz)
    {
        int ll,rr;
        ll=i*sz;
        rr=i*sz;
        for(int j=0; j<V[i].size(); j++)
        {
            int leftt=V[i][j].st;
            int rightt=V[i][j].ed;
            int inx=V[i][j].inx;
            // cout<<leftt<<" "<<rightt<<" "<<inx<<"\n";
            while(rr<rightt)
            {
                result+=cnt[prefix[rr]^k];
                cnt[prefix[rr]]++;
                rr++;
            }
            while(ll<leftt)
            {
                cnt[prefix[ll]]--;
                result-=cnt[prefix[ll]^k];
                ll++;
            }
            while(ll>leftt)
            {
                ll--;

                result+=cnt[prefix[ll]^k];
                cnt[prefix[ll]]++;
                //                rr++;
            }
            ans[inx]=result;

        }
        for(int j=ll; j<=rr; j++)
        {
            cnt[prefix[ll]]--;
            result-=cnt[prefix[ll]^k];

        }

    }

    FOR0(i,m)
    cout<<ans[i]<<" ";
}
int main()
{

    read();
    proc();

}


#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///prLLInewline
#define getLLI(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(LLI i=1;i<=n;i++)
#define FOR0(i,n)  for(LLI i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(LLI i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (LLI)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long LLI
#define LLI        long long
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

LLI Set(LLI N,LLI pos)
{
    return N=N | (1<<pos);
}
LLI reset(LLI N,LLI pos)
{
    return N= N & ~(1<<pos);
}
bool check(LLI N,LLI pos)
{
    return (bool)(N & (1<<pos));
}
void CI(LLI &_x)
{
    scanf("%d",&_x);
}

void CO(LLI &_x)
{
    cout<<_x;
}

template<typename T> void getarray(T a[],LLI n)
{
    for(LLI i=0; i<n; i++) cin>>a[i];
}
template<typename T> void prLLIarray(T a[],LLI n)
{
    for(LLI i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const LLI INF=0x7f7f7f7f;

LLI dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
LLI dc8[8]= {0,0,-1,1,1,1,-1,-1};
LLI dr4[4]= {0,0,1,-1};                      ///4 direction move
LLI dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
LLI kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
LLI kn8c[8]= {2,1,-1,-2,-2,-1,1,2};
#define mx 1000000
LLI n,m,k;
LLI prefix[mx],ans[mx],cnt[mx];
struct block
{
    LLI st,ed,inx;
    block() {}
    block(LLI st,LLI ed,LLI inx): st(st),ed(ed),inx(inx) {}
};
bool cmp(block a,block b)
{
    return a.ed<b.ed;

}
LLI sz=320;
vector<block>V[320];
void read()
{
    CI(n);
    CI(m);
    CI(k);
    FOR1(i,n)
    {
        CI(prefix[i]);

        prefix[i]=prefix[i]^prefix[i-1];

    }

    LLI l,r;
    FOR0(i,m)
    {

        CI(l);
        CI(r);
        l--,r++;
        V[l/sz].PB(block(l,r,i));
    }

}

void proc()
{
    FOR0(i,sz)sort(ALL(V[i]),cmp);
    LLI result=0;

    FOR0(i,sz)
    {
        LLI ll,rr;
        ll=i*sz;
        rr=i*sz;
        for(LLI j=0; j<V[i].size(); j++)
        {
            LLI leftt=V[i][j].st;
            LLI rightt=V[i][j].ed;
            LLI inx=V[i][j].inx;
            // cout<<leftt<<" "<<rightt<<" "<<inx<<"\n";
            while(rr<rightt)
            {
                result+=cnt[prefix[rr]^k];
                cnt[prefix[rr]]++;
                rr++;
            }
            while(ll<leftt)
            {
                cnt[prefix[ll]]--;
                result-=cnt[prefix[ll]^k];
                ll++;
            }
            while(ll>leftt)
            {
                ll--;

                result+=cnt[prefix[ll]^k];
                cnt[prefix[ll]]++;
                //                rr++;
            }
            ans[inx]=result;

        }
        for(LLI j=ll; j<=rr; j++)
        {
            cnt[prefix[ll]]--;
            result-=cnt[prefix[ll]^k];

        }

    }

    FOR0(i,m)
    cout<<ans[i]<<" ";
}
int main()
{

    read();
    proc();

}


#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///prLLInewline
#define getLLI(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(LLI i=1;i<=n;i++)
#define FOR0(i,n)  for(LLI i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(LLI i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (LLI)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long LLI
#define LLI        long long
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

LLI Set(LLI N,LLI pos)
{
    return N=N | (1<<pos);
}
LLI reset(LLI N,LLI pos)
{
    return N= N & ~(1<<pos);
}
bool check(LLI N,LLI pos)
{
    return (bool)(N & (1<<pos));
}
void CI(LLI &_x)
{
    cin>>_x;
}

void CO(LLI &_x)
{
    cout<<_x;
}

template<typename T> void getarray(T a[],LLI n)
{
    for(LLI i=0; i<n; i++) cin>>a[i];
}
template<typename T> void prLLIarray(T a[],LLI n)
{
    for(LLI i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const LLI INF=0x7f7f7f7f;

LLI dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
LLI dc8[8]= {0,0,-1,1,1,1,-1,-1};
LLI dr4[4]= {0,0,1,-1};                      ///4 direction move
LLI dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
LLI kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
LLI kn8c[8]= {2,1,-1,-2,-2,-1,1,2};
#define mx 1000005
LLI n,m,k;
LLI prefix[mx],ans[mx],cnt[1<<21];
struct block
{
    LLI st,ed,inx;
    block() {}
    block(LLI st,LLI ed,LLI inx): st(st),ed(ed),inx(inx) {}
};
bool cmp(block a,block b)
{
    return a.ed<b.ed;

}
LLI sz=320;
vector<block>V[320];
void read()
{
    CI(n);
    CI(m);
    CI(k);
    FOR1(i,n)
    {
        CI(prefix[i]);

        prefix[i]=prefix[i]^prefix[i-1];

    }

    LLI l,r;
    FOR0(i,m)
    {

        CI(l);
        CI(r);
        l--,r++;
        V[l/sz].PB(block(l,r,i));
    }

}

void proc()
{
    FOR0(i,sz)sort(ALL(V[i]),cmp);
    LLI result=0;

    FOR0(i,sz)
    {
        LLI ll,rr;
        ll=i*sz;
        rr=i*sz;
        for(LLI j=0; j<V[i].size(); j++)
        {
            LLI leftt=V[i][j].st;
            LLI rightt=V[i][j].ed;
            LLI inx=V[i][j].inx;
            // cout<<leftt<<" "<<rightt<<" "<<inx<<"\n";
            while(rr<rightt)
            {
                result+=cnt[prefix[rr]^k];
                cnt[prefix[rr]]++;
                rr++;
            }
            while(ll<leftt)
            {
                cnt[prefix[ll]]--;
                result-=cnt[prefix[ll]^k];
                ll++;
            }
            while(ll>leftt)
            {
                ll--;

                result+=cnt[prefix[ll]^k];
                cnt[prefix[ll]]++;
                //                rr++;
            }
            ans[inx]=result;

        }
        for(LLI j=ll; j<=rr; j++)
        {
            cnt[prefix[j]]--;
            result-=cnt[prefix[j]^k];

        }

    }

    FOR0(i,m)
    cout<<ans[i]<<" ";
}
int main()
{
    std::ios::sync_with_stdio(false);
    read();
    proc();

}


#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///prLLInewline
#define getLLI(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(LLI i=1;i<=n;i++)
#define FOR0(i,n)  for(LLI i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(LLI i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (LLI)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long LLI
#define LLI        long long
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

LLI Set(LLI N,LLI pos)
{
    return N=N | (1<<pos);
}
LLI reset(LLI N,LLI pos)
{
    return N= N & ~(1<<pos);
}
bool check(LLI N,LLI pos)
{
    return (bool)(N & (1<<pos));
}
void CI(LLI &_x)
{
    cin>>_x;
}

void CO(LLI &_x)
{
    cout<<_x;
}

template<typename T> void getarray(T a[],LLI n)
{
    for(LLI i=0; i<n; i++) cin>>a[i];
}
template<typename T> void prLLIarray(T a[],LLI n)
{
    for(LLI i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const LLI INF=0x7f7f7f7f;

LLI dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
LLI dc8[8]= {0,0,-1,1,1,1,-1,-1};
LLI dr4[4]= {0,0,1,-1};                      ///4 direction move
LLI dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
LLI kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
LLI kn8c[8]= {2,1,-1,-2,-2,-1,1,2};
#define mx 1000005
LLI n,m,k;
LLI prefix[mx],ans[mx],cnt[1<<21];
struct block
{
    LLI st,ed,inx;
    block() {}
    block(LLI st,LLI ed,LLI inx): st(st),ed(ed),inx(inx) {}
};
bool cmp(block a,block b)
{
    return a.ed<b.ed;

}
LLI sz=320;
vector<block>V[320];
void read()
{
    CI(n);
    CI(m);
    CI(k);
    FOR1(i,n)
    {
        CI(prefix[i]);

        prefix[i]=prefix[i]^prefix[i-1];

    }

    LLI l,r;
    FOR0(i,m)
    {

        CI(l);
        CI(r);
        l--,r++;
        V[l/sz].PB(block(l,r,i));
    }

}
 LLI result=0;
void add(int v) {
    result+= cnt[v^k];
    cnt[v]++;
}

void del(int v) {
    cnt[v]--;
    result -= cnt[v ^ k];
}
void proc()
{
    FOR0(i,sz)sort(ALL(V[i]),cmp);

    FOR0(i,sz)
    {
        LLI ll,rr;
        ll=i*sz;
        rr=i*sz;
        for(LLI j=0; j<V[i].size(); j++)
        {
            LLI leftt=V[i][j].st;
            LLI rightt=V[i][j].ed;
            LLI inx=V[i][j].inx;
            // cout<<leftt<<" "<<rightt<<" "<<inx<<"\n";
            while(rr<rightt)
            {
               add(prefix[rr]);
                rr++;
            }
            while(ll<leftt)
            {
                del(prefix[ll]);
                ll++;
            }
            while(ll>leftt)
            {
                ll--;

                add(prefix[ll]);
                //                rr++;
            }
            ans[inx]=result;

        }
        for(LLI j=ll; j<=rr; j++)
       del(prefix[j]);
    }

    FOR0(i,m)
    cout<<ans[i]<<" ";
}
int main()
{
    std::ios::sync_with_stdio(false);
    read();
    proc();

}


#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///prLLInewline
#define getLLI(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(LLI i=1;i<=n;i++)
#define FOR0(i,n)  for(LLI i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(LLI i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (LLI)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long LLI
#define LLI        long long
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

LLI Set(LLI N,LLI pos)
{
    return N=N | (1<<pos);
}
LLI reset(LLI N,LLI pos)
{
    return N= N & ~(1<<pos);
}
bool check(LLI N,LLI pos)
{
    return (bool)(N & (1<<pos));
}
void CI(LLI &_x)
{
    cin>>_x;
}

void CO(LLI &_x)
{
    cout<<_x;
}

template<typename T> void getarray(T a[],LLI n)
{
    for(LLI i=0; i<n; i++) cin>>a[i];
}
template<typename T> void prLLIarray(T a[],LLI n)
{
    for(LLI i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const LLI INF=0x7f7f7f7f;

LLI dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
LLI dc8[8]= {0,0,-1,1,1,1,-1,-1};
LLI dr4[4]= {0,0,1,-1};                      ///4 direction move
LLI dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
LLI kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
LLI kn8c[8]= {2,1,-1,-2,-2,-1,1,2};
#define mx 1000005
LLI n,m,k;
LLI prefix[mx],ans[mx],cnt[mx*10];
struct block
{
    LLI st,ed,inx;
    block() {}
    block(LLI st,LLI ed,LLI inx): st(st),ed(ed),inx(inx) {}
};
bool cmp(block a,block b)
{
    return a.ed<b.ed;

}
LLI sz=320;
vector<block>V[320];
void read()
{
    CI(n);
    CI(m);
    CI(k);
    FOR1(i,n)
    {
        CI(prefix[i]);

        prefix[i]=prefix[i]^prefix[i-1];

    }

    LLI l,r;
    FOR0(i,m)
    {

        CI(l);
        CI(r);
        l--,r++;
        V[l/sz].PB(block(l,r,i));
    }

}

void proc()
{
    FOR0(i,sz)sort(ALL(V[i]),cmp);
    LLI result=0;

    FOR0(i,sz)
    {
        LLI ll,rr;
        ll=i*sz;
        rr=i*sz;
        for(LLI j=0; j<V[i].size(); j++)
        {
            LLI leftt=V[i][j].st;
            LLI rightt=V[i][j].ed;
            LLI inx=V[i][j].inx;
            // cout<<leftt<<" "<<rightt<<" "<<inx<<"\n";
            while(rr<rightt)
            {
                result+=cnt[prefix[rr]^k];
                cnt[prefix[rr]]++;
                rr++;
            }
            while(ll<leftt)
            {
                cnt[prefix[ll]]--;
                result-=cnt[prefix[ll]^k];
                ll++;
            }
            while(ll>leftt)
            {
                ll--;

                result+=cnt[prefix[ll]^k];
                cnt[prefix[ll]]++;
                //                rr++;
            }
            ans[inx]=result;

        }
        for(LLI j=ll; j<=rr; j++)
        {
            cnt[prefix[ll]]--;
            result-=cnt[prefix[ll]^k];

        }

    }

    FOR0(i,m)
    cout<<ans[i]<<" ";
}
int main()
{
std::ios::sync_with_stdio(false);
    read();
    proc();

}


#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///prLLInewline
#define getLLI(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(LLI i=1;i<=n;i++)
#define FOR0(i,n)  for(LLI i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(LLI i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (LLI)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long LLI
#define LLI        long long
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

LLI Set(LLI N,LLI pos)
{
    return N=N | (1<<pos);
}
LLI reset(LLI N,LLI pos)
{
    return N= N & ~(1<<pos);
}
bool check(LLI N,LLI pos)
{
    return (bool)(N & (1<<pos));
}
void CI(LLI &_x)
{
    cin>>_x;
}

void CO(LLI &_x)
{
    cout<<_x;
}

template<typename T> void getarray(T a[],LLI n)
{
    for(LLI i=0; i<n; i++) cin>>a[i];
}
template<typename T> void prLLIarray(T a[],LLI n)
{
    for(LLI i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const LLI INF=0x7f7f7f7f;

LLI dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
LLI dc8[8]= {0,0,-1,1,1,1,-1,-1};
LLI dr4[4]= {0,0,1,-1};                      ///4 direction move
LLI dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
LLI kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
LLI kn8c[8]= {2,1,-1,-2,-2,-1,1,2};
#define mx 1000005
LLI n,m,k;
LLI prefix[mx],ans[mx],cnt[1<<21];
struct block
{
    LLI st,ed,inx;
    block() {}
    block(LLI st,LLI ed,LLI inx): st(st),ed(ed),inx(inx) {}
};
bool cmp(block a,block b)
{
    return a.ed<b.ed;

}
LLI sz=320;
vector<block>V[320];
void read()
{
    CI(n);
    CI(m);
    CI(k);
    FOR1(i,n)
    {
        CI(prefix[i]);

        prefix[i]=prefix[i]^prefix[i-1];

    }

    LLI l,r;
    FOR0(i,m)
    {

        CI(l);
        CI(r);
        l--,r++;
        V[l/sz+2].PB(block(l,r,i));
    }

}
 LLI result=0;
void add(int v) {
    result+= cnt[v^k];
    cnt[v]++;
}

void del(int v) {
    cnt[v]--;
    result -= cnt[v ^ k];
}
void proc()
{
    FOR0(i,sz)sort(ALL(V[i]),cmp);

    FOR0(i,sz)
    {
        LLI ll,rr;
        ll=i*sz;
        rr=i*sz;
        for(LLI j=0; j<V[i].size(); j++)
        {
            LLI leftt=V[i][j].st;
            LLI rightt=V[i][j].ed;
            LLI inx=V[i][j].inx;
            // cout<<leftt<<" "<<rightt<<" "<<inx<<"\n";
            while(rr<rightt)
            {
               add(prefix[rr]);
                rr++;
            }
            while(ll<leftt)
            {
                del(prefix[ll]);
                ll++;
            }
            while(ll>leftt)
            {
                ll--;

                add(prefix[ll]);
                //                rr++;
            }
            ans[inx]=result;

        }
        for(LLI j=ll; j<=rr; j++)
       del(prefix[j]);
    }

    FOR0(i,m)
    cout<<ans[i]<<" ";
}
int main()
{
    std::ios::sync_with_stdio(false);
    read();
    proc();

}


#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///prLLInewline
#define getLLI(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(LLI i=1;i<=n;i++)
#define FOR0(i,n)  for(LLI i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(LLI i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (LLI)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long LLI
#define LLI        long long
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

LLI Set(LLI N,LLI pos)
{
    return N=N | (1<<pos);
}
LLI reset(LLI N,LLI pos)
{
    return N= N & ~(1<<pos);
}
bool check(LLI N,LLI pos)
{
    return (bool)(N & (1<<pos));
}
void CI(LLI &_x)
{
    cin>>_x;
}

void CO(LLI &_x)
{
    cout<<_x;
}

template<typename T> void getarray(T a[],LLI n)
{
    for(LLI i=0; i<n; i++) cin>>a[i];
}
template<typename T> void prLLIarray(T a[],LLI n)
{
    for(LLI i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const LLI INF=0x7f7f7f7f;

LLI dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
LLI dc8[8]= {0,0,-1,1,1,1,-1,-1};
LLI dr4[4]= {0,0,1,-1};                      ///4 direction move
LLI dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
LLI kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
LLI kn8c[8]= {2,1,-1,-2,-2,-1,1,2};
#define mx 1000005
LLI n,m,k;
LLI prefix[mx],ans[mx],cnt[1<<21];
struct block
{
    LLI st,ed,inx;
    block() {}
    block(LLI st,LLI ed,LLI inx): st(st),ed(ed),inx(inx) {}
};
bool cmp(block a,block b)
{
    return a.ed<b.ed;

}
LLI sz=320;
vector<block>V[320];
void read()
{
    CI(n);
    CI(m);
    CI(k);
    FOR1(i,n)
    {
        CI(prefix[i]);

        prefix[i]=prefix[i]^prefix[i-1];

    }

    LLI l,r;
    FOR0(i,m)
    {

        CI(l);
        CI(r);
        l--,r++;
        V[l/sz].PB(block(l,r,i));
    }

}
 LLI result=0;
void add(int v) {
    result+= cnt[v^k];
    cnt[v]++;
}

void del(int v) {
    cnt[v]--;
    result -= cnt[v ^ k];
}
void proc()
{
    FOR0(i,sz)sort(ALL(V[i]),cmp);

    FOR0(i,sz)
    {
        LLI ll,rr;
        ll=i*sz;
        rr=i*sz;
        for(LLI j=0; j<V[i].size(); j++)
        {
            LLI leftt=V[i][j].st;
            LLI rightt=V[i][j].ed;
            LLI inx=V[i][j].inx;
            // cout<<leftt<<" "<<rightt<<" "<<inx<<"\n";
            while(rr<rightt)
            {
               add(prefix[rr]);
                rr++;
            }
            while(ll<leftt)
            {
                del(prefix[ll]);
                ll++;
            }
            while(ll>leftt)
            {
                ll--;

                add(prefix[ll]);
                //                rr++;
            }
            ans[inx]=result;

        }
      memset(cnt,0,sizeof cnt);
      result=0;
    }

    FOR0(i,m)
    cout<<ans[i]<<" ";
}
int main()
{
    std::ios::sync_with_stdio(false);
    read();
    proc();

}


#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///prLLInewline
#define getLLI(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(LLI i=1;i<=n;i++)
#define FOR0(i,n)  for(LLI i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(LLI i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (LLI)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long LLI
#define LLI        long long
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

LLI Set(LLI N,LLI pos)
{
    return N=N | (1<<pos);
}
LLI reset(LLI N,LLI pos)
{
    return N= N & ~(1<<pos);
}
bool check(LLI N,LLI pos)
{
    return (bool)(N & (1<<pos));
}
void CI(LLI &_x)
{
    cin>>_x;
}

void CO(LLI &_x)
{
    cout<<_x;
}

template<typename T> void getarray(T a[],LLI n)
{
    for(LLI i=0; i<n; i++) cin>>a[i];
}
template<typename T> void prLLIarray(T a[],LLI n)
{
    for(LLI i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const LLI INF=0x7f7f7f7f;

LLI dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
LLI dc8[8]= {0,0,-1,1,1,1,-1,-1};
LLI dr4[4]= {0,0,1,-1};                      ///4 direction move
LLI dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
LLI kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
LLI kn8c[8]= {2,1,-1,-2,-2,-1,1,2};
#define mx 1000005
LLI n,m,k;
LLI prefix[mx],ans[mx],cnt[mx*100];
struct block
{
    LLI st,ed,inx;
    block() {}
    block(LLI st,LLI ed,LLI inx): st(st),ed(ed),inx(inx) {}
};
bool cmp(block a,block b)
{
    return a.ed<b.ed;

}
LLI sz=320;
vector<block>V[320];
void read()
{
    CI(n);
    CI(m);
    CI(k);
    FOR1(i,n)
    {
        CI(prefix[i]);

        prefix[i]=prefix[i]^prefix[i-1];

    }

    LLI l,r;
    FOR0(i,m)
    {

        CI(l);
        CI(r);
        l--,r++;
        V[l/sz].PB(block(l,r,i));
    }

}

void proc()
{
    FOR0(i,sz)sort(ALL(V[i]),cmp);
    LLI result=0;

    FOR0(i,sz)
    {
        LLI ll,rr;
        ll=i*sz;
        rr=i*sz;
        for(LLI j=0; j<V[i].size(); j++)
        {
            LLI leftt=V[i][j].st;
            LLI rightt=V[i][j].ed;
            LLI inx=V[i][j].inx;
            // cout<<leftt<<" "<<rightt<<" "<<inx<<"\n";
            while(rr<rightt)
            {
                result+=cnt[prefix[rr]^k];
                cnt[prefix[rr]]++;
                rr++;
            }
            while(ll<leftt)
            {
                cnt[prefix[ll]]--;
                result-=cnt[prefix[ll]^k];
                ll++;
            }
            while(ll>leftt)
            {
                ll--;

                result+=cnt[prefix[ll]^k];
                cnt[prefix[ll]]++;
                //                rr++;
            }
            ans[inx]=result;

        }
        for(LLI j=ll; j<=rr; j++)
        {
            cnt[prefix[ll]]--;
            result-=cnt[prefix[ll]^k];

        }

    }

    FOR0(i,m)
    cout<<ans[i]<<" ";
}
int main()
{
std::ios::sync_with_stdio(false);
    read();
    proc();

}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int BLOCK_SIZE = 316; //sqrt(1e5)

struct Query {
    int left, right, number;

    bool operator < (const Query other) const {
        return right < other.right;
    }
};

int cnt[1 << 20];
long long result = 0;
int favourite;

void add(int v) {    cnt[v]++;
    result += cnt[v ^ favourite];

}

void del(int v) {
    cnt[v]--;
    result -= cnt[v ^ favourite];
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);

    int n, m;
    cin >> n >> m >> favourite;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    vector<int> pref(n + 1);
    for (int i = 1; i <= n; i++) {
        pref[i] = pref[i - 1] ^ a[i - 1];
    }

    vector< vector<Query> > blocks(n / BLOCK_SIZE + 2, vector<Query>());
    for (int i = 0; i < m; i++) {
        int left, right;
        cin >> left >> right;
        left--; right++;
        blocks[left / BLOCK_SIZE].push_back(Query{left, right, i});
    }
    for (auto &i: blocks) {
        sort(i.begin(), i.end());
    }

    vector<long long> answer(m);
    for (int i = 0; i < blocks.size(); i++) {
        int left, right;
        left = right = i * BLOCK_SIZE;
        for (auto &q: blocks[i]) {
            while (right < q.right) {
                add(pref[right]);
                right++;
            }
            while (left < q.left) {
                del(pref[left]);
                left++;
            }
            while (left > q.left) {
                left--;
                add(pref[left]);
            }
            answer[q.number] = result;
        }
        for (int j = left; j < right; j++) {
            del(pref[j]);
        }
    }

    for (auto i: answer) {
        cout << i << '\n';
    }
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int BLOCK_SIZE = 316; //sqrt(1e5)

struct Query {
    int left, right, number;

    bool operator < (const Query other) const {
        return right < other.right;
    }
};

int cnt[1 << 20];
long long result = 0;
int favourite;

void add(int v) {
    result += cnt[v ^ favourite];
    cnt[v]++;
}

void del(int v) {

    result -= cnt[v ^ favourite];
cnt[v]--;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);

    int n, m;
    cin >> n >> m >> favourite;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    vector<int> pref(n + 1);
    for (int i = 1; i <= n; i++) {
        pref[i] = pref[i - 1] ^ a[i - 1];
    }

    vector< vector<Query> > blocks(n / BLOCK_SIZE + 2, vector<Query>());
    for (int i = 0; i < m; i++) {
        int left, right;
        cin >> left >> right;
        left--; right++;
        blocks[left / BLOCK_SIZE].push_back(Query{left, right, i});
    }
    for (auto &i: blocks) {
        sort(i.begin(), i.end());
    }

    vector<long long> answer(m);
    for (int i = 0; i < blocks.size(); i++) {
        int left, right;
        left = right = i * BLOCK_SIZE;
        for (auto &q: blocks[i]) {
            while (right < q.right) {
                add(pref[right]);
                right++;
            }
            while (left < q.left) {
                del(pref[left]);
                left++;
            }
            while (left > q.left) {
                left--;
                add(pref[left]);
            }
            answer[q.number] = result;
        }
        for (int j = left; j < right; j++) {
            del(pref[j]);
        }
    }

    for (auto i: answer) {
        cout << i << '\n';
    }
}


#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///prLLInewline
#define getLLI(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(LLI i=1;i<=n;i++)
#define FOR0(i,n)  for(LLI i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(LLI i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (LLI)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long LLI
#define LLI        long long
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

LLI Set(LLI N,LLI pos)
{
    return N=N | (1<<pos);
}
LLI reset(LLI N,LLI pos)
{
    return N= N & ~(1<<pos);
}
bool check(LLI N,LLI pos)
{
    return (bool)(N & (1<<pos));
}
void CI(LLI &_x)
{
    cin>>_x;
}

void CO(LLI &_x)
{
    cout<<_x;
}

template<typename T> void getarray(T a[],LLI n)
{
    for(LLI i=0; i<n; i++) cin>>a[i];
}
template<typename T> void prLLIarray(T a[],LLI n)
{
    for(LLI i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const LLI INF=0x7f7f7f7f;

LLI dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
LLI dc8[8]= {0,0,-1,1,1,1,-1,-1};
LLI dr4[4]= {0,0,1,-1};                      ///4 direction move
LLI dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
LLI kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
LLI kn8c[8]= {2,1,-1,-2,-2,-1,1,2};
#define mx 1000005
LLI n,m,k;
LLI prefix[mx],ans[mx],cnt[1<<21];
struct block
{
    LLI st,ed,inx;
    block() {}
    block(LLI st,LLI ed,LLI inx): st(st),ed(ed),inx(inx) {}
};
bool cmp(block a,block b)
{
    return a.ed<b.ed;

}
LLI sz=320;
vector<block>V[320];
void read()
{
    CI(n);
    CI(m);
    CI(k);
    FOR1(i,n)
    {
        CI(prefix[i]);

        prefix[i]=prefix[i]^prefix[i-1];

    }

    LLI l,r;
    FOR0(i,m)
    {

        CI(l);
        CI(r);
        l--,r++;
        V[l/sz].PB(block(l,r,i));
    }

}
 LLI result=0;
void add(int v) {
    result+= cnt[v^k];
    cnt[v]++;
}

void del(int v) {
    cnt[v]--;
    result -= cnt[v ^ k];
}
void proc()
{
    FOR0(i,sz)sort(ALL(V[i]),cmp);

    FOR0(i,sz)
    {
        LLI ll,rr;
        ll=i*sz;
        rr=i*sz;
        for(LLI j=0; j<V[i].size(); j++)
        {
            LLI leftt=V[i][j].st;
            LLI rightt=V[i][j].ed;
            LLI inx=V[i][j].inx;
            // cout<<leftt<<" "<<rightt<<" "<<inx<<"\n";
            while(rr<rightt)
            {
               add(prefix[rr]);
                rr++;
            }
            while(ll<leftt)
            {
                del(prefix[ll]);
                ll++;
            }
            while(ll>leftt)
            {
                ll--;

                add(prefix[ll]);
                //                rr++;
            }
            ans[inx]=result;

        }
        for(LLI j=ll; j<rr; j++)
       del(prefix[j]);
    }

    FOR0(i,m)
    cout<<ans[i]<<" ";
}
int main()
{
    std::ios::sync_with_stdio(false);
    read();
    proc();

}


#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///prLLInewline
#define getLLI(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(LLI i=1;i<=n;i++)
#define FOR0(i,n)  for(LLI i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(LLI i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (LLI)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long LLI
#define LLI        long long
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

LLI Set(LLI N,LLI pos)
{
    return N=N | (1<<pos);
}
LLI reset(LLI N,LLI pos)
{
    return N= N & ~(1<<pos);
}
bool check(LLI N,LLI pos)
{
    return (bool)(N & (1<<pos));
}
void CI(LLI &_x)
{
    cin>>_x;
}

void CO(LLI &_x)
{
    cout<<_x;
}

template<typename T> void getarray(T a[],LLI n)
{
    for(LLI i=0; i<n; i++) cin>>a[i];
}
template<typename T> void prLLIarray(T a[],LLI n)
{
    for(LLI i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const LLI INF=0x7f7f7f7f;

LLI dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
LLI dc8[8]= {0,0,-1,1,1,1,-1,-1};
LLI dr4[4]= {0,0,1,-1};                      ///4 direction move
LLI dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
LLI kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
LLI kn8c[8]= {2,1,-1,-2,-2,-1,1,2};
#define mx 1000005
LLI n,m,k;
LLI prefix[mx],ans[mx],cnt[1<<21];
struct block
{
    LLI st,ed,inx;
    block() {}
    block(LLI st,LLI ed,LLI inx): st(st),ed(ed),inx(inx) {}
};
bool cmp(block a,block b)
{
    return a.ed<b.ed;

}
LLI sz=320;
vector<block>V[320];
void read()
{
    CI(n);
    CI(m);
    CI(k);
    FOR1(i,n)
    {
        CI(prefix[i]);

        prefix[i]=prefix[i]^prefix[i-1];

    }

    LLI l,r;
    FOR0(i,m)
    {

        CI(l);
        CI(r);
        l--,r++;
        V[l/sz].PB(block(l,r,i));
    }

}

void proc()
{
    FOR0(i,sz)sort(ALL(V[i]),cmp);
    LLI result=0;

    FOR0(i,sz)
    {
        LLI ll,rr;
        ll=i*sz;
        rr=i*sz;
        for(LLI j=0; j<V[i].size(); j++)
        {
            LLI leftt=V[i][j].st;
            LLI rightt=V[i][j].ed;
            LLI inx=V[i][j].inx;
            // cout<<leftt<<" "<<rightt<<" "<<inx<<"\n";
            while(rr<rightt)
            {
                result+=cnt[prefix[rr]^k];
                cnt[prefix[rr]]++;
                rr++;
            }
            while(ll<leftt)
            {
                cnt[prefix[ll]]--;
                result-=cnt[prefix[ll]^k];
                ll++;
            }
            while(ll>leftt)
            {
                ll--;

                result+=cnt[prefix[ll]^k];
                cnt[prefix[ll]]++;
                //                rr++;
            }
            ans[inx]=result;

        }
        for(LLI j=ll; j<=rr; j++)
        {
            cnt[prefix[ll]]--;
            result-=cnt[prefix[ll]^k];

        }

    }

    FOR0(i,m)
    cout<<ans[i]<<" ";
}
int main()
{
std::ios::sync_with_stdio(false);
    read();
    proc();

}


#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///prLLInewline
#define getLLI(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(LLI i=1;i<=n;i++)
#define FOR0(i,n)  for(LLI i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(LLI i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (LLI)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long LLI
#define LLI        long long
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

LLI Set(LLI N,LLI pos)
{
    return N=N | (1<<pos);
}
LLI reset(LLI N,LLI pos)
{
    return N= N & ~(1<<pos);
}
bool check(LLI N,LLI pos)
{
    return (bool)(N & (1<<pos));
}
void CI(LLI &_x)
{
    cin>>_x;
}

void CO(LLI &_x)
{
    cout<<_x;
}

template<typename T> void getarray(T a[],LLI n)
{
    for(LLI i=0; i<n; i++) cin>>a[i];
}
template<typename T> void prLLIarray(T a[],LLI n)
{
    for(LLI i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const LLI INF=0x7f7f7f7f;

LLI dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
LLI dc8[8]= {0,0,-1,1,1,1,-1,-1};
LLI dr4[4]= {0,0,1,-1};                      ///4 direction move
LLI dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
LLI kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
LLI kn8c[8]= {2,1,-1,-2,-2,-1,1,2};
#define mx 1000000
LLI n,m,k;
LLI prefix[mx],ans[mx],cnt[mx];
struct block
{
    LLI st,ed,inx;
    block() {}
    block(LLI st,LLI ed,LLI inx): st(st),ed(ed),inx(inx) {}
};
bool cmp(block a,block b)
{
    return a.ed<b.ed;

}
LLI sz=320;
vector<block>V[320];
void read()
{
    CI(n);
    CI(m);
    CI(k);
    FOR1(i,n)
    {
        CI(prefix[i]);

        prefix[i]=prefix[i]^prefix[i-1];

    }

    LLI l,r;
    FOR0(i,m)
    {

        CI(l);
        CI(r);
        l--,r++;
        V[l/sz].PB(block(l,r,i));
    }

}

void proc()
{
    FOR0(i,sz)sort(ALL(V[i]),cmp);
    LLI result=0;

    FOR0(i,sz)
    {
        LLI ll,rr;
        ll=i*sz;
        rr=i*sz;
        for(LLI j=0; j<V[i].size(); j++)
        {
            LLI leftt=V[i][j].st;
            LLI rightt=V[i][j].ed;
            LLI inx=V[i][j].inx;
            // cout<<leftt<<" "<<rightt<<" "<<inx<<"\n";
            while(rr<rightt)
            {
                result+=cnt[prefix[rr]^k];
                cnt[prefix[rr]]++;
                rr++;
            }
            while(ll<leftt)
            {
                cnt[prefix[ll]]--;
                result-=cnt[prefix[ll]^k];
                ll++;
            }
            while(ll>leftt)
            {
                ll--;

                result+=cnt[prefix[ll]^k];
                cnt[prefix[ll]]++;
                //                rr++;
            }
            ans[inx]=result;

        }
        for(LLI j=ll; j<=rr; j++)
        {
            cnt[prefix[ll]]--;
            result-=cnt[prefix[ll]^k];

        }

    }

    FOR0(i,m)
    cout<<ans[i]<<" ";
}
int main()
{
std::ios::sync_with_stdio(false);
    read();
    proc();

}


#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = (1000000+100)*2;
const int S = 350;

typedef long long I64d;

int a[N];
int p[N];
I64d ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return (l/S) == (rhs.l/S) ? r < rhs.r : (l/S) < (rhs.l/S);
    }
};

vector<vector<itv>> x;

void addR(int i, I64d& cnt)
{
    cnt += v[ p[i]^k ];
    v[ p[i] ]++;
}

void addL(int i, I64d& cnt)
{
    cnt += v[ p[i-1]^k ];
    v[ p[i-1] ]++;
}

void delR(int i, I64d& cnt)
{
    v[ p[i] ]--;
    cnt -= v[ p[i]^k ];
}

void delL(int i, I64d& cnt)
{
    v[ p[i-1] ]--;
    cnt -= v[ p[i-1]^k ];
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    vector<itv> x = vector<itv>(q);
    p[0] = 0;

    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[i] = itv{l, r, i};
    }

    sort(x.begin(), x.end());
    v[0] = 1;
    itv cur = {1, 0, 0};
    I64d cnt = 0;

    for(int i = 0; i < q; i++)
    {
        for(; x[i].r < cur.r; cur.r--)
            delR(cur.r, cnt);
        for(; x[i].r > cur.r;)
            addR(++cur.r, cnt);
        for(; x[i].l < cur.l;)
            addL(--cur.l, cnt);
        for(; x[i].l > cur.l; cur.l++)
            delL(cur.l, cnt);

        ans[x[i].id] = cnt;
    }

    for(int i = 0; i < q; i++)
        printf("%I64d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 350;

typedef long long I64d;

int a[N];
int p[N];
I64d ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return (l/S) == (rhs.l/S) ? r < rhs.r : (l/S) < (rhs.l/S);
    }
};

vector<vector<itv>> x;

void addR(int i, I64d& cnt)
{
    if( i < 0 )
        for(;;);

    cnt += v[ p[i]^k ];
    v[ p[i] ]++;
}

void addL(int i, I64d& cnt)
{
    if( i < 1 )
        for(;;);

    cnt += v[ p[i-1]^k ];
    v[ p[i-1] ]++;
}

void delR(int i, I64d& cnt)
{
    if( i < 0 )
        for(;;);

    v[ p[i] ]--;
    cnt -= v[ p[i]^k ];
}

void delL(int i, I64d& cnt)
{
    if( i < 1 )
        for(;;);

    v[ p[i-1] ]--;
    cnt -= v[ p[i-1]^k ];
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    vector<itv> x = vector<itv>(q);
    p[0] = 0;

    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[i] = itv{l, r, i};
    }

    sort(x.begin(), x.end());
    v[0] = 1;
    itv cur = {1, 0, 0};
    I64d cnt = 0;

    for(int i = 0; i < q; i++)
    {
        for(; x[i].r < cur.r; cur.r--)
            delR(cur.r, cnt);
        for(; x[i].r > cur.r;)
            addR(++cur.r, cnt);
        for(; x[i].l < cur.l;)
            addL(--cur.l, cnt);
        for(; x[i].l > cur.l; cur.l++)
            delL(cur.l, cnt);

        if( cur.l != x[i].l || cur.r != x[i].r )
            for(;;);

        ans[x[i].id] = cnt;
    }

    for(int i = 0; i < q; i++)
        printf("%I64d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 320;

typedef long long I64d;

int a[N];
int p[N];
I64d ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return r < rhs.r;
    }
};

vector<vector<itv>> x;

void moveR(itv& cur, int r, I64d& cnt)
{
    for(int i = cur.r+1; i <= r; i++)
    {
        cnt += v[ p[i]^k ];
        v[ p[i] ]++;

        /*printf("~%d %d %d\n", cur.l, i, cnt);
        printf("~~%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
    }
    cur.r = r;
}

void moveL(itv& cur, int l, I64d& cnt)
{
    if( cur.l >= l )
    {
        for(int i = cur.l-1; i >= l; i--)
        {
            cnt += v[ p[i-1]^k ];
            v[ p[i-1] ]++;
            /*printf("@%d %d %d\n", i, cur.r, cnt);
            printf("@@%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }
    else
    {
        for(int i = cur.l; i < l; i++)
        {
            v[ p[i-1] ]--;
            cnt -= v[ p[i-1]^k ];

            /*printf("#%d %d %d\n", i, cur.r, cnt);
            printf("##%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }

    cur.l = l;
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    x = vector<vector<itv>>(S);
    p[0] = 0;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[l/S].push_back(itv{l, r, i});
    }

    for(int i = 0; i < S; i++)
        sort(x[i].begin(), x[i].end());

    for(int i = 0; i < S; i++)
    {
        itv cur = itv{i*S+1, i*S, 0};
        I64d cnt = 0;
        memset(v, 0, sizeof(v));
        v[0] = 1;
        for(int j = 0; j < x[i].size(); j++)
        {
            //printf("Q %d %d\n", x[i][j].l, x[i][j].r);

            moveR(cur, x[i][j].r, cnt);
            moveL(cur, x[i][j].l, cnt);

            ans[x[i][j].id] = cnt;
        }
    }

    for(int i = 0; i < q; i++)
        printf("%I64d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 320;

int a[N];
int p[N];
int ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return r < rhs.r;
    }
};

vector<vector<itv>> x;

void moveR(itv& cur, int r, int& cnt)
{
    for(int i = cur.r+1; i <= r; i++)
    {
        cnt += v[ p[i]^k ];
        v[ p[i] ]++;

        /*printf("~%d %d %d\n", cur.l, i, cnt);
        printf("~~%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
    }
    cur.r = r;
}

void moveL(itv& cur, int l, int& cnt)
{
    if( cur.l >= l )
    {
        for(int i = cur.l-1; i >= l; i--)
        {
            v[ p[i-1] ]++;
            cnt += v[ p[i-1]^k ];

            /*printf("@%d %d %d\n", i, cur.r, cnt);
            printf("@@%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }
    else
    {
        for(int i = cur.l; i < l; i++)
        {
            v[ p[i-1] ]--;
            cnt -= v[ p[i-1]^k ];

            /*printf("#%d %d %d\n", i, cur.r, cnt);
            printf("##%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }

    cur.l = l;
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    x = vector<vector<itv>>(S);
    p[0] = 0;
    v[0] = 1;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[l/S].push_back(itv{l, r, i});
    }

    for(int i = 0; i < S; i++)
        sort(x[i].begin(), x[i].end());

    itv cur = itv{1, 0, 0};
    int cnt = 0;

    for(int i = 0; i < S; i++)
    {
        for(int j = 0; j < x[i].size(); j++)
        {
            //printf("Q %d %d\n", x[i][j].l, x[i][j].r);

            moveR(cur, x[i][j].r, cnt);
            moveL(cur, x[i][j].l, cnt);

            ans[x[i][j].id] = cnt;
        }
    }

    for(int i = 0; i < q; i++)
        printf("%d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 320;

typedef long long I64d;

int a[N];
int p[N];
I64d ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return r < rhs.r;
    }
};

vector<vector<itv>> x;

void moveR(itv& cur, int r, I64d& cnt)
{
    for(int i = cur.r+1; i <= r; i++)
    {
        cnt += v[ p[i]^k ];
        v[ p[i] ]++;

        /*printf("~%d %d %d\n", cur.l, i, cnt);
        printf("~~%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
    }
    cur.r = r;
}

void moveL(itv& cur, int l, I64d& cnt)
{
    if( cur.l >= l )
    {
        for(int i = cur.l-1; i >= l; i--)
        {
            cnt += v[ p[i-1]^k ];
            v[ p[i-1] ]++;
            /*printf("@%d %d %d\n", i, cur.r, cnt);
            printf("@@%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }
    else
    {
        for(int i = cur.l; i < l; i++)
        {
            v[ p[i-1] ]--;
            cnt -= v[ p[i-1]^k ];

            /*printf("#%d %d %d\n", i, cur.r, cnt);
            printf("##%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }

    cur.l = l;
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    x = vector<vector<itv>>(S);
    p[0] = 0;
    v[0] = 1;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[l/S].push_back(itv{l, r, i});
    }

    for(int i = 0; i < S; i++)
        sort(x[i].begin(), x[i].end());

    itv cur = itv{1, 0, 0};
    I64d cnt = 0;

    for(int i = 0; i < S; i++)
    {
        for(int j = 0; j < x[i].size(); j++)
        {
            //printf("Q %d %d\n", x[i][j].l, x[i][j].r);

            moveR(cur, x[i][j].r, cnt);
            moveL(cur, x[i][j].l, cnt);

            ans[x[i][j].id] = cnt;
        }
    }

    for(int i = 0; i < q; i++)
        printf("%I64d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 350;

typedef long long I64d;

int a[N];
int p[N];
I64d ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return (l/S) == (rhs.l/S) ? r < rhs.r : (l/S) < (rhs.l/S);
    }
};

vector<vector<itv>> x;

void addR(int i, I64d& cnt)
{
    cnt += v[ p[i]^k ];
    v[ p[i] ]++;
}

void addL(int i, I64d& cnt)
{
    cnt += v[ p[i-1]^k ];
    v[ p[i-1] ]++;
}

void delR(int i, I64d& cnt)
{
    v[ p[i] ]--;
    cnt -= v[ p[i]^k ];
}

void delL(int i, I64d& cnt)
{
    v[ p[i-1] ]--;
    cnt -= v[ p[i-1]^k ];
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    vector<itv> x = vector<itv>(q);
    p[0] = 0;

    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[i] = itv{l, r, i};
    }

    sort(x.begin(), x.end());
    v[0] = 1;
    itv cur = {1, 0, 0};
    I64d cnt = 0;

    for(int i = 0; i < q; i++)
    {
        for(; x[i].r < cur.r; cur.r--)
            delR(cur.r, cnt);
        for(; x[i].r > cur.r;)
            addR(++cur.r, cnt);
        for(; x[i].l < cur.l;)
            addL(--cur.l, cnt);
        for(; x[i].l > cur.l; cur.l++)
            delL(cur.l, cnt);

        if( cur.l != x[i].l || cur.r != x[i].r )
            for(;;);

        ans[x[i].id] = cnt;
    }

    for(int i = 0; i < q; i++)
        printf("%I64d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 320;

typedef long long I64d;

int a[N];
int p[N];
I64d ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return r < rhs.r;
    }
};

vector<vector<itv>> x;

void moveR(itv& cur, int r, I64d& cnt)
{
    for(int i = cur.r+1; i <= r; i++)
    {
        cnt += v[ p[i]^k ];
        v[ p[i] ]++;

        /*printf("~%d %d %d\n", cur.l, i, cnt);
        printf("~~%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
    }
    cur.r = r;
}

void moveL(itv& cur, int l, I64d& cnt)
{
    if( cur.l >= l )
    {
        for(int i = cur.l-1; i >= l; i--)
        {
            cnt += v[ p[i-1]^k ];
            v[ p[i-1] ]++;
            /*printf("@%d %d %d\n", i, cur.r, cnt);
            printf("@@%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }
    else
    {
        for(int i = cur.l; i < l; i++)
        {
            v[ p[i-1] ]--;
            cnt -= v[ p[i-1]^k ];

            /*printf("#%d %d %d\n", i, cur.r, cnt);
            printf("##%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }

    cur.l = l;
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    x = vector<vector<itv>>(S);
    p[0] = 0;
    v[0] = 1;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[l/S].push_back(itv{l, r, i});
    }

    for(int i = 0; i < S; i++)
        sort(x[i].begin(), x[i].end());

    for(int i = 0; i < S; i++)
    {
        itv cur = itv{i*S+1, i*S, 0};
        I64d cnt = 0;
        for(int j = 0; j < x[i].size(); j++)
        {
            //printf("Q %d %d\n", x[i][j].l, x[i][j].r);

            moveR(cur, x[i][j].r, cnt);
            moveL(cur, x[i][j].l, cnt);

            ans[x[i][j].id] = cnt;
        }
    }

    for(int i = 0; i < q; i++)
        printf("%I64d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 320;

typedef long long I64d;

int a[N];
int p[N];
I64d ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return r < rhs.r;
    }
};

vector<vector<itv>> x;

void moveR(itv& cur, int r, I64d& cnt)
{
    for(int i = cur.r+1; i <= r; i++)
    {
        cnt += v[ p[i]^k ];
        v[ p[i] ]++;

        /*printf("~%d %d %d\n", cur.l, i, cnt);
        printf("~~%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
    }
    cur.r = r;
}

void moveL(itv& cur, int l, int& cnt)
{
    if( cur.l >= l )
    {
        for(int i = cur.l-1; i >= l; i--)
        {
            cnt += v[ p[i-1]^k ];
            v[ p[i-1] ]++;
            /*printf("@%d %d %d\n", i, cur.r, cnt);
            printf("@@%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }
    else
    {
        for(int i = cur.l; i < l; i++)
        {
            v[ p[i-1] ]--;
            cnt -= v[ p[i-1]^k ];

            /*printf("#%d %d %d\n", i, cur.r, cnt);
            printf("##%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }

    cur.l = l;
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    x = vector<vector<itv>>(S);
    p[0] = 0;
    v[0] = 1;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[l/S].push_back(itv{l, r, i});
    }

    for(int i = 0; i < S; i++)
        sort(x[i].begin(), x[i].end());

    itv cur = itv{1, 0, 0};
    I64d cnt = 0;

    for(int i = 0; i < S; i++)
    {
        for(int j = 0; j < x[i].size(); j++)
        {
            //printf("Q %d %d\n", x[i][j].l, x[i][j].r);

            moveR(cur, x[i][j].r, cnt);
            moveL(cur, x[i][j].l, cnt);

            ans[x[i][j].id] = cnt;
        }
    }

    for(int i = 0; i < q; i++)
        printf("%I64d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 320;

typedef long long I64d;

int a[N];
int p[N];
I64d ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return r < rhs.r;
    }
};

vector<vector<itv>> x;

void moveR(itv& cur, int r, I64d& cnt)
{
    for(int i = cur.r+1; i <= r; i++)
    {
        cnt += v[ p[i]^k ];
        v[ p[i] ]++;

        /*printf("~%d %d %d\n", cur.l, i, cnt);
        printf("~~%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
    }
    cur.r = r;
}

void moveL(itv& cur, int l, int& cnt)
{
    if( cur.l >= l )
    {
        for(int i = cur.l-1; i >= l; i--)
        {
            cnt += v[ p[i-1]^k ];
            v[ p[i-1] ]++;
            /*printf("@%d %d %d\n", i, cur.r, cnt);
            printf("@@%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }
    else
    {
        for(int i = cur.l; i < l; i++)
        {
            v[ p[i-1] ]--;
            cnt -= v[ p[i-1]^k ];

            /*printf("#%d %d %d\n", i, cur.r, cnt);
            printf("##%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }

    cur.l = l;
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    x = vector<vector<itv>>(S);
    p[0] = 0;
    v[0] = 1;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[l/S].push_back(itv{l, r, i});
    }

    for(int i = 0; i < S; i++)
        sort(x[i].begin(), x[i].end());

    itv cur = itv{1, 0, 0};
    int cnt = 0;

    for(int i = 0; i < S; i++)
    {
        for(int j = 0; j < x[i].size(); j++)
        {
            //printf("Q %d %d\n", x[i][j].l, x[i][j].r);

            moveR(cur, x[i][j].r, cnt);
            moveL(cur, x[i][j].l, cnt);

            ans[x[i][j].id] = cnt;
        }
    }

    for(int i = 0; i < q; i++)
        printf("%I64d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 350;

typedef long long I64d;

int a[N];
int p[N];
I64d ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return (l/S) == (rhs.l/S) ? r < rhs.r : (l/S) < (rhs.l/S);
    }
};

vector<vector<itv>> x;

void addR(int i, I64d& cnt)
{
    cnt += v[ p[i]^k ];
    v[ p[i] ]++;
}

void addL(int i, I64d& cnt)
{
    cnt += v[ p[i-1]^k ];
    v[ p[i-1] ]++;
}

void delR(int i, I64d& cnt)
{
    v[ p[i] ]--;
    cnt -= v[ p[i]^k ];
}

void delL(int i, I64d& cnt)
{
    v[ p[i-1] ]--;
    cnt -= v[ p[i-1]^k ];
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    vector<itv> x = vector<itv>(q);
    p[0] = 0;

    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[i] = itv{l, r, i};
    }

    sort(x.begin(), x.end());
    v[0] = 1;
    itv cur = {1, 0, 0};
    I64d cnt = 0;

    for(int i = 0; i < q; i++)
    {
        for(; x[i].r < cur.r; cur.r--)
            delR(cur.r, cnt);
        for(; x[i].r > cur.r;)
            addR(++cur.r, cnt);
        for(; x[i].l < cur.l;)
            addL(--cur.l, cnt);
        for(; x[i].l > cur.l; cur.l++)
            delL(cur.l, cnt);

        ans[x[i].id] = cnt;
    }

    for(int i = 0; i < q; i++)
        printf("%I64d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 320;

int a[N];
int p[N];
int ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return r < rhs.r;
    }
};

vector<vector<itv>> x;

void moveR(itv& cur, int r, int& cnt)
{
    for(int i = cur.r+1; i <= r; i++)
    {
        cnt += v[ p[i]^k ];
        v[ p[i] ]++;

        /*printf("~%d %d %d\n", cur.l, i, cnt);
        printf("~~%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
    }
    cur.r = r;
}

void moveL(itv& cur, int l, int& cnt)
{
    if( cur.l >= l )
    {
        for(int i = cur.l-1; i >= l; i--)
        {
            cnt += v[ p[i-1]^k ];
            v[ p[i-1] ]++;
            /*printf("@%d %d %d\n", i, cur.r, cnt);
            printf("@@%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }
    else
    {
        for(int i = cur.l; i < l; i++)
        {
            v[ p[i-1] ]--;
            cnt -= v[ p[i-1]^k ];

            /*printf("#%d %d %d\n", i, cur.r, cnt);
            printf("##%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }

    cur.l = l;
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    x = vector<vector<itv>>(S);
    p[0] = 0;
    v[0] = 1;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[l/S].push_back(itv{l, r, i});
    }

    for(int i = 0; i < S; i++)
        sort(x[i].begin(), x[i].end());

    itv cur = itv{1, 0, 0};
    int cnt = 0;

    for(int i = 0; i < S; i++)
    {
        for(int j = 0; j < x[i].size(); j++)
        {
            //printf("Q %d %d\n", x[i][j].l, x[i][j].r);

            moveR(cur, x[i][j].r, cnt);
            moveL(cur, x[i][j].l, cnt);

            ans[x[i][j].id] = cnt;
        }
    }

    for(int i = 0; i < q; i++)
        printf("%d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 320;

int a[N];
int p[N];
int ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return r < rhs.r;
    }
};

vector<vector<itv>> x;

void moveR(itv& cur, int r, int& cnt)
{
    for(int i = cur.r+1; i <= r; i++)
    {
        cnt += v[ p[i]^k ];
        v[ p[i] ]++;

        /*printf("~%d %d %d\n", cur.l, i, cnt);
        printf("~~%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
    }
    cur.r = r;
}

void moveL(itv& cur, int l, int& cnt)
{
    if( cur.l >= l )
    {
        for(int i = cur.l-1; i >= l; i--)
        {
            cnt += v[ p[i-1]^k ];
            v[ p[i-1] ]++;
            /*printf("@%d %d %d\n", i, cur.r, cnt);
            printf("@@%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }
    else
    {
        for(int i = cur.l; i < l; i++)
        {
            cnt -= v[ p[i-1]^k ];
            v[ p[i-1] ]--;

            /*printf("#%d %d %d\n", i, cur.r, cnt);
            printf("##%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }

    cur.l = l;
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    x = vector<vector<itv>>(S);
    p[0] = 0;
    v[0] = 1;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[l/S].push_back(itv{l, r, i});
    }

    for(int i = 0; i < S; i++)
        sort(x[i].begin(), x[i].end());

    itv cur = itv{1, 0, 0};
    int cnt = 0;

    for(int i = 0; i < S; i++)
    {
        for(int j = 0; j < x[i].size(); j++)
        {
            //printf("Q %d %d\n", x[i][j].l, x[i][j].r);

            moveR(cur, x[i][j].r, cnt);
            moveL(cur, x[i][j].l, cnt);

            ans[x[i][j].id] = cnt;
        }
    }

    for(int i = 0; i < q; i++)
        printf("%d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = (1000000+100)*2;
const int S = 350;

typedef long long I64d;

int a[N];
int p[N];
I64d ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return r < rhs.r;
    }
};

vector<vector<itv>> x;

void moveR(itv& cur, int r, I64d& cnt)
{
    for(int i = cur.r+1; i <= r; i++)
    {
        cnt += v[ p[i]^k ];
        v[ p[i] ]++;
    }
    cur.r = r;
}

void moveL(itv& cur, int l, I64d& cnt)
{
    if( cur.l >= l )
    {
        for(int i = cur.l-1; i >= l; i--)
        {
            cnt += v[ p[i-1]^k ];
            v[ p[i-1] ]++;
        }
    }
    else
    {
        for(int i = cur.l; i < l; i++)
        {
            v[ p[i-1] ]--;
            cnt -= v[ p[i-1]^k ];
        }
    }

    cur.l = l;
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    x = vector<vector<itv>>(S);
    p[0] = 0;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[l/S].push_back(itv{l, r, i});
    }

    for(int i = 0; i < S; i++)
        sort(x[i].begin(), x[i].end());

    for(int i = 0; i < S; i++)
    {
        itv cur = itv{i*S+1, i*S, 0};
        I64d cnt = 0;
        memset(v, 0, sizeof(v));
        v[0] = 1;

        for(int j = 0; j < x[i].size(); j++)
        {
            moveR(cur, x[i][j].r, cnt);
            moveL(cur, x[i][j].l, cnt);

            ans[x[i][j].id] = cnt;
        }
    }

    for(int i = 0; i < q; i++)
        printf("%I64d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 320;

typedef long long I64d;

int a[N];
int p[N];
I64d ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return r < rhs.r;
    }
};

vector<vector<itv>> x;

void moveR(itv& cur, int r, int& cnt)
{
    for(int i = cur.r+1; i <= r; i++)
    {
        cnt += v[ p[i]^k ];
        v[ p[i] ]++;

        /*printf("~%d %d %d\n", cur.l, i, cnt);
        printf("~~%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
    }
    cur.r = r;
}

void moveL(itv& cur, int l, int& cnt)
{
    if( cur.l >= l )
    {
        for(int i = cur.l-1; i >= l; i--)
        {
            cnt += v[ p[i-1]^k ];
            v[ p[i-1] ]++;
            /*printf("@%d %d %d\n", i, cur.r, cnt);
            printf("@@%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }
    else
    {
        for(int i = cur.l; i < l; i++)
        {
            v[ p[i-1] ]--;
            cnt -= v[ p[i-1]^k ];

            /*printf("#%d %d %d\n", i, cur.r, cnt);
            printf("##%d %d %d %d\n", v[0], v[1], v[2], v[3]);*/
        }
    }

    cur.l = l;
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    x = vector<vector<itv>>(S);
    p[0] = 0;
    v[0] = 1;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[l/S].push_back(itv{l, r, i});
    }

    for(int i = 0; i < S; i++)
        sort(x[i].begin(), x[i].end());

    itv cur = itv{1, 0, 0};
    int cnt = 0;

    for(int i = 0; i < S; i++)
    {
        for(int j = 0; j < x[i].size(); j++)
        {
            //printf("Q %d %d\n", x[i][j].l, x[i][j].r);

            moveR(cur, x[i][j].r, cnt);
            moveL(cur, x[i][j].l, cnt);

            ans[x[i][j].id] = cnt;
        }
    }

    for(int i = 0; i < q; i++)
        printf("%I64d\n", ans[i]);

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100000+10;
const int V = 1000000+100;
const int S = 350;

typedef long long I64d;

int a[N];
int p[N];
I64d ans[N];
int v[V];
int k;

struct itv
{
    int l, r, id;

    bool operator< (const itv& rhs) const
    {
        return r < rhs.r;
    }
};

vector<vector<itv>> x;

void moveR(itv& cur, int r, I64d& cnt)
{
    for(int i = cur.r+1; i <= r; i++)
    {
        cnt += v[ p[i]^k ];
        v[ p[i] ]++;
    }
    cur.r = r;
}

void moveL(itv& cur, int l, I64d& cnt)
{
    if( cur.l >= l )
    {
        for(int i = cur.l-1; i >= l; i--)
        {
            cnt += v[ p[i-1]^k ];
            v[ p[i-1] ]++;
        }
    }
    else
    {
        for(int i = cur.l; i < l; i++)
        {
            v[ p[i-1] ]--;
            cnt -= v[ p[i-1]^k ];
        }
    }

    cur.l = l;
}

int main()
{
    int n, q;
    scanf("%d %d %d", &n, &q, &k);
    x = vector<vector<itv>>(S);
    p[0] = 0;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        p[i] = p[i-1]^a[i];
    }

    for(int i = 0; i < q; i++)
    {
        int l,r;
        scanf("%d %d", &l, &r);
        x[l/S].push_back(itv{l, r, i});
    }

    for(int i = 0; i < S; i++)
        sort(x[i].begin(), x[i].end());

    for(int i = 0; i < S; i++)
    {
        itv cur = itv{i*S+1, i*S, 0};
        I64d cnt = 0;
        memset(v, 0, sizeof(v));
        v[0] = 1;

        for(int j = 0; j < x[i].size(); j++)
        {
            moveR(cur, x[i][j].r, cnt);
            moveL(cur, x[i][j].l, cnt);

            ans[x[i][j].id] = cnt;
        }
    }

    for(int i = 0; i < q; i++)
        printf("%I64d\n", ans[i]);

    return 0;
}


 # include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;

const ll maxN = ll(8e5);
const ll smaxN = ll(5e3);
const ll mmaxN = ll(3e4);
const ll lmaxN = ll(3e6);
const ll oo = ll(1e18);
const ll MOD = ll(1e9) + 7;
const ld EPS = 1e-10;
const ld PI = acos(0.0) * 2;
const ll dx[] = {-1, +0, +0, +1};
const ll dy[] = {+0, -1, +1, +0};

template<typename T>
T Sqr(T x) {
    return x * x;
}

template<class T>
ll Sz(T x) {
    return ll(x.size());
}

inline ll MultMod(ll a, ll b, ll mod) {
    if(b < 0)
        return (a * b) % mod;
    if(b == 0)
        return 0;
    if(b % 2)
        return (MultMod(a, b - 1, mod) + a) % mod;
    return (MultMod(a, b / 2, mod) * 2) % mod;
}

inline ll ModPow(ll a, ll b, ll mod){
    if(b == 0)
        return 1ll % mod;
    if(b == 1)
        return a % mod;
    if(b % 2)
        return MultMod(ModPow(a, b - 1, mod), a, mod) % mod;
    ll z = ModPow(a, b / 2, mod);
    return (MultMod(z, z, mod)) % mod;
}

void compress(vector < ll > &a){
    vector < ll > b(a);
    sort(b.begin(), b.end());
    b.erase(unique(b.begin(), b.end()), b.end());
    for(auto &i : a) i = lower_bound(b.begin(), b.end(), i) - b.begin() + 1;
}

inline bool Palindrome(const string &s){
    return equal(s.begin(), s.end(), s.rbegin());
}

inline bool Prime(ll x){
    if(x < 2)
        return 0;
    for(ll i = 2; i * i <= x; ++i)
        if(x % i == 0)
            return 0;
    return 1;
}

inline bool IsProbablePrime(ll x){
    return 1; // -> returns 1
}

ll BLOCK;

struct Query{
    ll l, r, id;
    Query(){}

    Query(ll l, ll r, ll id) : l(l), r(r), id(id){}

    bool operator < (Query b) const{
        ll lb = this -> l / BLOCK, rb = b.l / BLOCK;
        if(lb != rb)
            return lb < rb;
        return this -> r > b.r;
    }

    ~Query(){}
};

ll n, m, k, l, r, now;
ll pref[lmaxN], cnt[lmaxN], res[lmaxN];
vector < Query > v;

void Add(ll val){
    now += cnt[val ^ k];
    ++cnt[val];

}

void Del(ll val){
    now -= cnt[val ^ k];
    --cnt[val];
}

main(){
    scanf("%I64d %I64d %I64d", &n, &m, &k);
    for(ll i = 1; i <= n; ++i)
        scanf("%I64d", &pref[i]), pref[i] ^= pref[i - 1];
    for(ll i = 1; i <= m; ++i){
        scanf("%I64d %I64d", &l, &r);
        --l;
        v.push_back(Query(l, r, i));
    }
    sort(v.begin(), v.end());
    ll L = v[0].l, R = v[0].r;
    for(ll i = L; i <= R; ++i) Add(pref[i]);
    res[v[0].id] = now;
    for(ll c = 1; c < Sz(v); ++c){
        while(L < v[c].l)
            Del(pref[L]), ++L;
        while(L > v[c].l)
            Add(pref[L - 1]), --L;
        while(R > v[c].r)
            Del(pref[R]), --R;
        while(R < v[c].r)
            Add(pref[R + 1]), ++R;
        res[v[c].id] = now;
    }
    for(ll i = 1; i <= m; ++i)
        printf("%I64d\n", res[i]);
    return 0;
}


# include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;

const ll maxN = ll(8e5);
const ll smaxN = ll(5e3);
const ll mmaxN = ll(3e4);
const ll lmaxN = ll(3e6);
const ll oo = ll(1e18);
const ll MOD = ll(1e9) + 7;
const ld EPS = 1e-10;
const ld PI = acos(0.0) * 2;
const ll dx[] = {-1, +0, +0, +1};
const ll dy[] = {+0, -1, +1, +0};

template<typename T>
T Sqr(T x) {
    return x * x;
}

template<class T>
ll Sz(T x) {
    return ll(x.size());
}

inline ll MultMod(ll a, ll b, ll mod) {
    if(b < 0)
        return (a * b) % mod;
    if(b == 0)
        return 0;
    if(b % 2)
        return (MultMod(a, b - 1, mod) + a) % mod;
    return (MultMod(a, b / 2, mod) * 2) % mod;
}

inline ll ModPow(ll a, ll b, ll mod){
    if(b == 0)
        return 1ll % mod;
    if(b == 1)
        return a % mod;
    if(b % 2)
        return MultMod(ModPow(a, b - 1, mod), a, mod) % mod;
    ll z = ModPow(a, b / 2, mod);
    return (MultMod(z, z, mod)) % mod;
}

void compress(vector < ll > &a){
    vector < ll > b(a);
    sort(b.begin(), b.end());
    b.erase(unique(b.begin(), b.end()), b.end());
    for(auto &i : a) i = lower_bound(b.begin(), b.end(), i) - b.begin() + 1;
}

inline bool Palindrome(const string &s){
    return equal(s.begin(), s.end(), s.rbegin());
}

inline bool Prime(ll x){
    if(x < 2)
        return 0;
    for(ll i = 2; i * i <= x; ++i)
        if(x % i == 0)
            return 0;
    return 1;
}

inline bool IsProbablePrime(ll x){
    return 1; // -> returns 1
}

ll BLOCK;

struct Query{
    ll l, r, id;
    Query(){}

    Query(ll l, ll r, ll id) : l(l), r(r), id(id){}

    bool operator < (Query b) const{
        return (this -> l / BLOCK != b.l / BLOCK ? this -> l / BLOCK < b.l / BLOCK : this -> r > b.r);
    }

    ~Query(){}
};

ll n, m, k, l, r, now;
ll pref[lmaxN], cnt[lmaxN], res[lmaxN];
vector < Query > v;

void Add(ll val){
    ++cnt[val];
    now += cnt[val ^ k];
}

void Del(ll val){
    now -= cnt[val ^ k];
    --cnt[val];
}

main(){
    scanf("%lld %lld %lld", &n, &m, &k);
    BLOCK = (ll)sqrt(n + .0) + 1;
    for(ll i = 1; i <= n; ++i)
        scanf("%lld", &pref[i]), pref[i] ^= pref[i - 1];
    for(ll i = 1; i <= m; ++i){
        scanf("%lld %lld", &l, &r);
        --l;
        v.push_back(Query(l, r, i));
    }
    sort(v.begin(), v.end());
    ll L = v[0].l, R = v[0].r;
    for(ll i = L; i <= R; ++i) Add(pref[i]);
    res[v[0].id] = now;
    for(ll c = 1; c < Sz(v); ++c){
        while(L < v[c].l)
            Del(pref[L]), ++L;
        while(L > v[c].l)
            Add(pref[L - 1]), --L;
        while(R > v[c].r)
            Del(pref[R]), --R;
        while(R < v[c].r)
            Add(pref[R + 1]), ++R;
        res[v[c].id] = now;
    }
    for(ll i = 1; i <= m; ++i)
        printf("%lld\n", res[i]);
    return 0;
}


# include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;

const ll maxN = ll(8e5);
const ll smaxN = ll(5e3);
const ll mmaxN = ll(3e4);
const ll lmaxN = ll(3e6);
const ll oo = ll(1e18);
const ll MOD = ll(1e9) + 7;
const ld EPS = 1e-10;
const ld PI = acos(0.0) * 2;
const ll dx[] = {-1, +0, +0, +1};
const ll dy[] = {+0, -1, +1, +0};

template<typename T>
T Sqr(T x) {
    return x * x;
}

template<class T>
ll Sz(T x) {
    return ll(x.size());
}

inline ll MultMod(ll a, ll b, ll mod) {
    if(b < 0)
        return (a * b) % mod;
    if(b == 0)
        return 0;
    if(b % 2)
        return (MultMod(a, b - 1, mod) + a) % mod;
    return (MultMod(a, b / 2, mod) * 2) % mod;
}

inline ll ModPow(ll a, ll b, ll mod){
    if(b == 0)
        return 1ll % mod;
    if(b == 1)
        return a % mod;
    if(b % 2)
        return MultMod(ModPow(a, b - 1, mod), a, mod) % mod;
    ll z = ModPow(a, b / 2, mod);
    return (MultMod(z, z, mod)) % mod;
}

void compress(vector < ll > &a){
    vector < ll > b(a);
    sort(b.begin(), b.end());
    b.erase(unique(b.begin(), b.end()), b.end());
    for(auto &i : a) i = lower_bound(b.begin(), b.end(), i) - b.begin() + 1;
}

inline bool Palindrome(const string &s){
    return equal(s.begin(), s.end(), s.rbegin());
}

inline bool Prime(ll x){
    if(x < 2)
        return 0;
    for(ll i = 2; i * i <= x; ++i)
        if(x % i == 0)
            return 0;
    return 1;
}

inline bool IsProbablePrime(ll x){
    return 1; // -> returns 1
}

ll BLOCK;

struct Query{
    ll l, r, id;
    Query(){}

    Query(ll l, ll r, ll id) : l(l), r(r), id(id){}

    bool operator < (Query b) const{
        ll lb = this -> l / BLOCK, rb = b.l / BLOCK;
        if(lb != rb)
            return lb < rb;
        return this -> r > b.r;
    }

    ~Query(){}
};

ll n, m, k, l, r, now;
ll pref[lmaxN], cnt[lmaxN], res[lmaxN];
vector < Query > v;

void Add(ll val){
    ++cnt[val];
    now += cnt[val ^ k];
}

void Del(ll val){
    now -= cnt[val ^ k];
    --cnt[val];
}

main(){
    scanf("%lld %lld %lld", &n, &m, &k);
    BLOCK = (ll)sqrt(n + .0) + 1;
    for(ll i = 1; i <= n; ++i)
        scanf("%lld", &pref[i]), pref[i] ^= pref[i - 1];
    for(ll i = 1; i <= m; ++i){
        scanf("%lld %lld", &l, &r);
        --l;
        v.push_back(Query(l, r, i));
    }
    sort(v.begin(), v.end());
    ll L = v[0].l, R = v[0].r;
    for(ll i = L; i <= R; ++i) Add(pref[i]);
    res[v[0].id] = now;
    for(ll c = 1; c < Sz(v); ++c){
        while(L < v[c].l)
            Del(pref[L]), ++L;
        while(L > v[c].l)
            Add(pref[L - 1]), --L;
        while(R > v[c].r)
            Del(pref[R]), --R;
        while(R < v[c].r)
            Add(pref[R + 1]), ++R;
        res[v[c].id] = now;
    }
    for(ll i = 1; i <= m; ++i)
        printf("%lld\n", res[i]);
    return 0;
}


# include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;

const ll maxN = ll(8e5);
const ll smaxN = ll(5e3);
const ll mmaxN = ll(3e4);
const ll lmaxN = ll(3e6);
const ll oo = ll(1e18);
const ll MOD = ll(1e9) + 7;
const ld EPS = 1e-10;
const ld PI = acos(0.0) * 2;
const ll dx[] = {-1, +0, +0, +1};
const ll dy[] = {+0, -1, +1, +0};

template<typename T>
T Sqr(T x) {
    return x * x;
}

template<class T>
ll Sz(T x) {
    return ll(x.size());
}

inline ll MultMod(ll a, ll b, ll mod) {
    if(b < 0)
        return (a * b) % mod;
    if(b == 0)
        return 0;
    if(b % 2)
        return (MultMod(a, b - 1, mod) + a) % mod;
    return (MultMod(a, b / 2, mod) * 2) % mod;
}

inline ll ModPow(ll a, ll b, ll mod){
    if(b == 0)
        return 1ll % mod;
    if(b == 1)
        return a % mod;
    if(b % 2)
        return MultMod(ModPow(a, b - 1, mod), a, mod) % mod;
    ll z = ModPow(a, b / 2, mod);
    return (MultMod(z, z, mod)) % mod;
}

void compress(vector < ll > &a){
    vector < ll > b(a);
    sort(b.begin(), b.end());
    b.erase(unique(b.begin(), b.end()), b.end());
    for(auto &i : a) i = lower_bound(b.begin(), b.end(), i) - b.begin() + 1;
}

inline bool Palindrome(const string &s){
    return equal(s.begin(), s.end(), s.rbegin());
}

inline bool Prime(ll x){
    if(x < 2)
        return 0;
    for(ll i = 2; i * i <= x; ++i)
        if(x % i == 0)
            return 0;
    return 1;
}

inline bool IsProbablePrime(ll x){
    return 1; // -> returns 1
}

ll BLOCK;

struct Query{
    ll l, r, id;
    Query(){}

    Query(ll l, ll r, ll id) : l(l), r(r), id(id){}

    bool operator < (Query b) const{
        return (this -> l / BLOCK != b.l / BLOCK ? this -> l / BLOCK < b.l / BLOCK : this -> r < b.r);
    }

    ~Query(){}
};

ll n, m, k, l, r, now;
ll pref[lmaxN], cnt[lmaxN], res[lmaxN];
vector < Query > v;

void Add(ll val){
    ++cnt[val];
    now += cnt[val ^ k];
}

void Del(ll val){
    now -= cnt[val ^ k];
    --cnt[val];
}

main(){
    scanf("%lld %lld %lld", &n, &m, &k);
    BLOCK = (ll)sqrt(n + .0) + 1;
    for(ll i = 1; i <= n; ++i)
        scanf("%lld", &pref[i]), pref[i] ^= pref[i - 1];
    for(ll i = 1; i <= m; ++i){
        scanf("%lld %lld", &l, &r);
        --l;
        v.push_back(Query(l, r, i));
    }
    sort(v.begin(), v.end());
    ll L = v[0].l, R = v[0].r;
    for(ll i = L; i <= R; ++i) Add(pref[i]);
    res[v[0].id] = now;
    for(ll c = 1; c < Sz(v); ++c){
        while(L < v[c].l)
            Del(pref[L]), ++L;
        while(L > v[c].l)
            Add(pref[L - 1]), --L;
        while(R > v[c].r)
            Del(pref[R]), --R;
        while(R < v[c].r)
            Add(pref[R + 1]), ++R;
        res[v[c].id] = now;
    }
    for(ll i = 1; i <= m; ++i)
        printf("%lld\n", res[i]);
    return 0;
}


# include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;

const ll maxN = ll(8e5);
const ll smaxN = ll(5e3);
const ll mmaxN = ll(3e4);
const ll lmaxN = ll(3e6);
const ll oo = ll(1e18);
const ll MOD = ll(1e9) + 7;
const ld EPS = 1e-10;
const ld PI = acos(0.0) * 2;
const ll dx[] = {-1, +0, +0, +1};
const ll dy[] = {+0, -1, +1, +0};

template<typename T>
T Sqr(T x) {
    return x * x;
}

template<class T>
ll Sz(T x) {
    return ll(x.size());
}

inline ll MultMod(ll a, ll b, ll mod) {
    if(b < 0)
        return (a * b) % mod;
    if(b == 0)
        return 0;
    if(b % 2)
        return (MultMod(a, b - 1, mod) + a) % mod;
    return (MultMod(a, b / 2, mod) * 2) % mod;
}

inline ll ModPow(ll a, ll b, ll mod){
    if(b == 0)
        return 1ll % mod;
    if(b == 1)
        return a % mod;
    if(b % 2)
        return MultMod(ModPow(a, b - 1, mod), a, mod) % mod;
    ll z = ModPow(a, b / 2, mod);
    return (MultMod(z, z, mod)) % mod;
}

void compress(vector < ll > &a){
    vector < ll > b(a);
    sort(b.begin(), b.end());
    b.erase(unique(b.begin(), b.end()), b.end());
    for(auto &i : a) i = lower_bound(b.begin(), b.end(), i) - b.begin() + 1;
}

inline bool Palindrome(const string &s){
    return equal(s.begin(), s.end(), s.rbegin());
}

inline bool Prime(ll x){
    if(x < 2)
        return 0;
    for(ll i = 2; i * i <= x; ++i)
        if(x % i == 0)
            return 0;
    return 1;
}

inline bool IsProbablePrime(ll x){
    return 1; // -> returns 1
}

ll BLOCK = 317;

struct Query{
    ll l, r, id;
    Query(){}

    Query(ll l, ll r, ll id) : l(l), r(r), id(id){}

    bool operator < (Query b) const{
        if(l / BLOCK != b.l / BLOCK)
            return l / BLOCK < b.l / BLOCK;
        return r < b.r;
    }

    ~Query(){}
};

ll n, m, k, l, r, now;
ll pref[lmaxN], cnt[lmaxN], res[lmaxN];
Query v[maxN];

void Add(ll val){
    now += cnt[val ^ k];
    ++cnt[val];
}

void Del(ll val){
    now -= cnt[val ^ k];
    --cnt[val];
}

main(){
    scanf("%I64d %I64d %I64d", &n, &m, &k);
    for(ll i = 1; i <= n; ++i)
        scanf("%I64d", &pref[i]), pref[i] ^= pref[i - 1];
    for(ll i = 1; i <= m; ++i){
        scanf("%I64d %I64d", &l, &r);
        --l;
        v[i] = Query(l, r, i);
    }
    sort(v + 1, v + 1 + m);
    ll L = v[1].l, R = v[1].r;
    for(ll i = L; i <= R; ++i) Add(pref[i]);
    res[v[1].id] = now;
    for(ll c = 2; c <= m; ++c){
        while(L < v[c].l)
            Del(pref[L]), ++L;
        while(L > v[c].l)
            Add(pref[L - 1]), --L;
        while(R > v[c].r)
            Del(pref[R]), --R;
        while(R < v[c].r)
            Add(pref[R + 1]), ++R;
        res[v[c].id] = now;
    }
    for(ll i = 1; i <= m; ++i)
        printf("%I64d\n", res[i]);
    return 0;
}