#include <bits/stdc++.h>
const int MOD = 1000000007;
const int N = 1e5 + 15;
const int maxn = 5e6 + 14;
const int letter = 130;
const int INF = 1e9;
const double pi = acos(-1.0);
const double eps = 1e-8;
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, q, k, tt;
int a[N], pos[N];
long long ans[N], dis[maxn], sum;
struct node {
  int l, r, id;
} e[N];
bool cmp1(node a, node b) {
  if (pos[a.l] == pos[b.l])
    return a.r < b.r;
  else
    return a.l < b.l;
}
void check(int id, int f) {
  int x = a[id];
  if (f == 1)
    sum += dis[x ^ k], dis[x]++;
  else
    dis[x]--, sum -= dis[x ^ k];
}
void solve() {
  sum = 0;
  int l = 1, r = 0;
  for (int i = 0; i < q; i++) {
    for (; r < e[i].r; r++) check(r + 1, 1);
    for (; r > e[i].r; r--) check(r, -1);
    for (; l < e[i].l; l++) check(l, -1);
    for (; l > e[i].l; l--) check(l - 1, 1);
    ans[e[i].id] = sum;
  }
  for (int i = 0; i < q; i++) printf("%I64d\n", ans[i]);
}
int main() {
  scanf("%d%d%d", &n, &q, &k);
  tt = (int)sqrt(n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    pos[i] = (i - 1) / tt + 1;
  }
  for (int i = 1; i <= n; i++) a[i] ^= a[i - 1];
  for (int i = 0; i < q; i++) {
    scanf("%d%d", &e[i].l, &e[i].r);
    e[i].l--;
    e[i].id = i;
  }
  sort(e, e + q, cmp1);
  solve();
  return 0;
}
