#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
inline int add(int a, int b) {
  a += b;
  return a >= 1000000007 ? a - 1000000007 : a;
}
inline int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + 1000000007 : a;
}
inline int mul(int a, int b) { return (long long int)a * b % 1000000007; }
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Cheek(int N, int pos) { return (bool)(N & (1 << pos)); }
int n, q, k, blocksz, ara[100099], cxor[100099], fre[3000009];
long long int tot = 0, ans[100099];
struct info {
  int id, l, r;
  bool operator<(const info &p) const {
    int blockno = l / blocksz;
    int pblockno = p.l / blocksz;
    if (blockno == pblockno)
      return r < p.r;
    else
      return blockno < pblockno;
  }
} query[100099];
void Add(int idx) {
  tot += fre[cxor[idx] ^ k];
  fre[cxor[idx]]++;
}
void Remove(int idx) {
  fre[cxor[idx]]--;
  tot -= fre[cxor[idx] ^ k];
}
void Solve(int t) {
  int i, j;
  scanf("%d %d %d", &n, &q, &k);
  blocksz = sqrt(n * 1.0);
  for (i = 1; i <= n; i++) {
    scanf("%d", &(ara[i]));
    cxor[i] = cxor[i - 1] ^ ara[i];
  }
  for (i = 1; i <= q; i++) {
    scanf("%d %d", &(query[i].l), &(query[i].r));
    query[i].l--;
    query[i].id = i;
  }
  sort(query + 1, query + q + 1);
  int l = 0, r = -1;
  for (i = 1; i <= q; i++) {
    while (r < query[i].r) Add(++r);
    while (l < query[i].l) Remove(l++);
    while (r > query[i].r) Remove(r--);
    while (l > query[i].l) Add(--l);
    ans[query[i].id] = tot;
  }
  for (i = 1; i <= q; i++) printf("%lld\n", ans[i]);
}
int main() {
  int t, T;
  T = 1;
  for (__typeof(t) t = 1; t <= T; t++) {
    Solve(t);
  }
  return 0;
}
