#include <bits/stdc++.h>
using namespace std;
int read_int() {
  char ch = 0;
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  int res = 0;
  int sign = 1;
  if (ch == '-') {
    sign = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    res = res * 10 + (ch - '0');
    ch = getchar();
  }
  return sign * res;
}
int n;
int m;
int a[1000055], res[1000055];
map<int, int> last;
vector<pair<int, int> > vec[1000055];
int dat[4000055];
int lazy[4000055];
void update(int id, int x, int y, int l, int r, int val) {
  if (x > r || y < l) return;
  if (x != y && lazy[id]) {
    dat[id + id] ^= lazy[id];
    dat[id + id + 1] ^= lazy[id];
    lazy[id + id] ^= lazy[id];
    lazy[id + id + 1] ^= lazy[id];
    lazy[id] = 0;
  }
  if (l <= x && y <= r) {
    dat[id] ^= val;
    lazy[id] ^= val;
    return;
  }
  int mid = (x + y) >> 1;
  update(id + id, x, mid, l, r, val);
  update(id + id + 1, mid + 1, y, l, r, val);
}
int query(int id, int x, int y, int l, int r) {
  if (x > r || y < l) return 0;
  if (x != y && lazy[id]) {
    dat[id + id] ^= lazy[id];
    dat[id + id + 1] ^= lazy[id];
    lazy[id + id] ^= lazy[id];
    lazy[id + id + 1] ^= lazy[id];
    lazy[id] = 0;
  }
  if (l <= x && y <= r) return dat[id];
  int mid = (x + y) >> 1;
  return query(id + id, x, mid, l, r) + query(id + id + 1, mid + 1, y, l, r);
}
int main() {
  n = read_int();
  for (int i = 0; i < n; i++) {
    a[i] = read_int();
    if (i) a[i] ^= a[i - 1];
  }
  m = read_int();
  int l, r;
  for (int i = 0; i < m; i++) {
    l = read_int(), r = read_int();
    l--, r--;
    vec[r].push_back(pair<int, int>(l, i));
  }
  for (int i = 0; i < n; i++) {
    int q = a[i];
    if (i) q ^= a[i - 1];
    int cur = a[i];
    if (i) cur ^= a[i - 1];
    if (i) {
      q ^= query(1, 0, n - 1, i - 1, i - 1);
    }
    if (last.find(cur) == last.end()) {
      last[cur] = i;
    } else {
      update(1, 0, n - 1, last[cur], i - 1, cur);
      q ^= cur;
      last[cur] = i;
    }
    update(1, 0, n - 1, i, i, q);
    for (auto p : vec[i]) {
      int sum = a[i] ^ (p.first - 1 < 0 ? 0 : a[p.first - 1]);
      sum ^=
          q ^
          (p.first - 1 < 0 ? 0 : query(1, 0, n - 1, p.first - 1, p.first - 1));
      res[p.second] = sum;
    }
  }
  for (int i = 0; i < m; i++) printf("%d\n", res[i]);
  return 0;
}
