#include <bits/stdc++.h>
using namespace std;
vector<int> v1[1000002], g1[1000002];
int ans[1000002], arr[1000002], par[1000002];
map<int, int> las;
int tree[1000002 * 3];
void init(int node, int b, int e) {
  if (b == e) {
    tree[node] = arr[b];
    return;
  }
  int Left = node * 2;
  int Right = node * 2 + 1;
  int mid = (b + e) / 2;
  init(Left, b, mid);
  init(Right, mid + 1, e);
  tree[node] = tree[Left] ^ tree[Right];
}
int query(int node, int b, int e, int i, int j) {
  if (i > e || j < b) return 0;
  if (b >= i && e <= j) return tree[node];
  int Left = node * 2;
  int Right = node * 2 + 1;
  int mid = (b + e) / 2;
  int p1 = query(Left, b, mid, i, j);
  int p2 = query(Right, mid + 1, e, i, j);
  return p1 ^ p2;
}
void update(int node, int b, int e, int i, int newvalue) {
  if (i > e || i < b) return;
  if (b >= i && e <= i) {
    tree[node] = newvalue;
    return;
  }
  int Left = node * 2;
  int Right = node * 2 + 1;
  int mid = (b + e) / 2;
  update(Left, b, mid, i, newvalue);
  update(Right, mid + 1, e, i, newvalue);
  tree[node] = tree[Left] ^ tree[Right];
}
int main() {
  int a, b, c, d, e, i, j, k, p, q, y, z;
  scanf("%d", &a);
  for (i = 1; i <= a; i++) {
    scanf("%d", &arr[i]);
    par[i] = par[i - 1] ^ arr[i];
  }
  scanf("%d", &b);
  for (i = 1; i <= b; i++) {
    scanf("%d %d", &c, &d);
    v1[d].push_back(c);
    g1[d].push_back(i);
  }
  for (i = 1; i <= a; i++) {
    p = las[arr[i]];
    if (p > 0) {
      update(1, 1, a, p, 0);
    }
    update(1, 1, a, i, arr[i]);
    las[arr[i]] = i;
    q = v1[i].size();
    for (j = 0; j < q; j++) {
      y = v1[i][j];
      z = g1[i][j];
      ans[z] =
          query(1, 1, a, 1, i) ^ query(1, 1, a, 1, y - 1) ^ par[i] ^ par[y - 1];
    }
  }
  for (i = 1; i <= b; i++) {
    printf("%d\n", ans[i]);
  }
  return 0;
}
