#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int maxn = 1 << 20;
const int mod = 1e9 + 7;
struct q {
  int l, r, id;
} Q[maxn];
int pos[maxn];
long long ans[maxn], flag[maxn], a[maxn];
bool cmp(q a, q b) {
  if (pos[a.l] == pos[b.l]) return a.r < b.r;
  return pos[a.l] < pos[b.l];
}
int L = 1, R = 0, k;
long long Ans = 0;
void del(int x) {
  flag[a[x]]--;
  Ans -= flag[a[x] ^ k];
}
void add(int x) {
  Ans += flag[a[x] ^ k];
  flag[a[x]]++;
}
int main() {
  int n, m;
  scanf("%d%d%d", &n, &m, &k);
  int sz = sqrt(n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &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;
  }
  flag[0] = 1;
  sort(Q + 1, Q + 1 + m, cmp);
  for (int i = 1; i <= m; i++) {
    while (L < Q[i].l) {
      del(L - 1);
      L++;
    }
    while (L > Q[i].l) {
      L--;
      add(L - 1);
    }
    while (R < Q[i].r) {
      R++;
      add(R);
    }
    while (R > Q[i].r) {
      del(R);
      R--;
    }
    ans[Q[i].id] = Ans;
  }
  for (int i = 1; i <= m; i++) printf("%lld\n", ans[i]);
  return 0;
}
