#include <bits/stdc++.h>
using namespace std;
int n, m, k;
long long sz;
int a[(1 << 20) + 1], pos[(1 << 20) + 1];
long long nowl = 1, nowr = 0, nowans = 0;
long long ans[(1 << 20) + 1];
long long flag[(1 << 20) + 1];
struct node {
  int l, r, id;
} q[(1 << 20) + 1];
bool cmp(node a, node b) {
  if (pos[a.l] == pos[b.l])
    return a.r < b.r;
  else
    return pos[a.l] < pos[b.l];
}
void Add(int x) {
  nowans += flag[a[x] ^ k];
  flag[a[x]]++;
}
void Del(int x) {
  flag[a[x]]--;
  nowans -= flag[a[x] ^ k];
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  sz = sqrt(n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i] = a[i] ^ a[i - 1];
    pos[i] = i / sz;
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &q[i].l, &q[i].r);
    q[i].id = i;
  }
  sort(q + 1, q + 1 + m, cmp);
  flag[0] = 1;
  for (int i = 1; i <= m; i++) {
    while (nowl < q[i].l) {
      Del(nowl - 1);
      nowl++;
    }
    while (nowl > q[i].l) {
      nowl--;
      Add(nowl - 1);
    }
    while (nowr < q[i].r) {
      nowr++;
      Add(nowr);
    }
    while (nowr > q[i].r) {
      Del(nowr);
      nowr--;
    }
    ans[q[i].id] = nowans;
  }
  for (int i = 1; i <= m; i++) cout << ans[i] << endl;
}
