#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
struct Node {
  int l, r;
  int id;
} q[N];
int n, m, a[N], k;
int block;
long long ans, cnt[N * 2];
long long res[N];
bool cmp(Node a, Node b) {
  return (a.l / block) ^ (b.l / block)
             ? a.l < b.l
             : (((a.l / block) & 1) ? a.r < b.r : a.r > b.r);
}
void add(int x) {
  ans += cnt[a[x] ^ k];
  ++cnt[a[x]];
}
void del(int x) {
  --cnt[a[x]];
  ans -= cnt[a[x] ^ k];
}
int main() {
  while (scanf("%d%d%d", &n, &m, &k) != EOF) {
    memset(cnt, 0, sizeof(cnt));
    ans = 0;
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), a[i] ^= a[i - 1];
    for (int i = 1; i <= m; i++) {
      scanf("%d%d", &q[i].l, &q[i].r);
      q[i].id = i, --q[i].l;
    }
    block = sqrt(m * 2 / 3 * 1.0);
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    for (int i = 1; i <= m; i++) {
      int ql = q[i].l, qr = q[i].r;
      while (l > ql) add(--l);
      while (r < qr) add(++r);
      while (l < ql) del(l++);
      while (r > qr) del(r--);
      res[q[i].id] = ans;
    }
    for (int i = 1; i <= m; i++) printf("%lld\n", res[i]);
  }
  return 0;
}
