#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const int len = 700, MAX = 1e7 + 10;
int n, m, k, a[maxn];
int f[MAX], g[MAX];
long long ans[maxn];
struct query {
  int l, r, id;
} q[maxn];
bool operator<(const query &a, const query &b) {
  if ((a.l - 1) / len != (b.l - 1) / len) return a.l < b.l;
  return a.r < b.r;
}
void enter() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) {
    cin >> q[i].l >> q[i].r;
    q[i].id = i;
  }
  sort(q + 1, q + m + 1);
}
int lim(int i) { return ((i - 1) / len + 1) * len; }
void solve() {
  long long ret = 0;
  int rgt = 0, it, cur = 0;
  g[0] = 1;
  for (int i = 1; i <= m; ++i) {
    if (rgt < lim(q[i].l)) {
      rgt = lim(q[i].l);
      it = rgt + 1;
      memset(f, 0, sizeof(f));
      f[0] = 1;
      cur = 0;
      ret = 0;
    }
    if (q[i].r <= rgt) {
      long long tmp = 0;
      for (int j = q[i].l, v = 0; j <= q[i].r; ++j) {
        v ^= a[j];
        tmp += g[v ^ k];
        ++g[v];
      }
      ans[q[i].id] = tmp;
      for (int j = q[i].l, v = 0; j <= q[i].r; ++j) {
        v ^= a[j];
        --g[v];
      }
      continue;
    }
    while (it <= q[i].r) {
      cur ^= a[it++];
      ret += f[cur ^ k];
      ++f[cur];
    }
    long long save = ret;
    --f[0];
    for (int j = rgt, v = 0; j >= q[i].l; --j) {
      v ^= a[j];
      ret += f[v ^ k];
      ret += g[v ^ k];
      ++g[v];
    }
    ++f[0];
    ans[q[i].id] = ret;
    for (int j = rgt, v = 0; j >= q[i].l; --j) {
      v ^= a[j];
      --g[v];
    }
    ret = save;
  }
}
int main() {
  ios_base ::sync_with_stdio(0);
  enter();
  solve();
  for (int i = 1; i <= m; ++i) printf("%I64d\n", ans[i]);
}
