#include <bits/stdc++.h>
using namespace std;
int num[1000100];
int ans[1000100];
int num2[1000100];
int fin[1000100];
int tree[1000100 << 2];
pair<pair<int, int>, int> p[1000100];
map<int, vector<int> > mp;
bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  return a.first.second > b.first.second;
}
void build(int l, int r, int n) {
  if (l == r) {
    tree[n] = num2[l];
    return;
  }
  build(l, ((l + r) >> 1), n << 1);
  build(((l + r) >> 1) + 1, r, n << 1 | 1);
  tree[n] = tree[n << 1] ^ tree[n << 1 | 1];
}
int query(int st, int ed, int l, int r, int n) {
  if (st == l && ed == r) return tree[n];
  if (ed <= ((l + r) >> 1))
    return query(st, ed, l, ((l + r) >> 1), n << 1);
  else if (st > ((l + r) >> 1))
    return query(st, ed, ((l + r) >> 1) + 1, r, n << 1 | 1);
  else
    return query(st, ((l + r) >> 1), l, ((l + r) >> 1), n << 1) ^
           query(((l + r) >> 1) + 1, ed, ((l + r) >> 1) + 1, r, n << 1 | 1);
}
void change(int pos, int val, int l, int r, int n) {
  if (l == r) {
    tree[n] = val;
    return;
  }
  if (pos <= ((l + r) >> 1))
    change(pos, val, l, ((l + r) >> 1), n << 1);
  else
    change(pos, val, ((l + r) >> 1) + 1, r, n << 1 | 1);
  tree[n] = tree[n << 1] ^ tree[n << 1 | 1];
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &num[i]);
    ans[i] = ans[i - 1] ^ num[i];
  }
  int m;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    int st, ed;
    scanf("%d%d", &st, &ed);
    p[i] = make_pair(make_pair(st, ed), i);
  }
  sort(p + 1, p + 1 + m, cmp);
  n = p[1].first.second;
  for (int i = n; i >= 1; i--) {
    if (mp.find(num[i]) == mp.end()) {
      mp[num[i]].push_back(1);
      num2[i] = num[i];
    }
    mp[num[i]].push_back(i);
  }
  build(1, n, 1);
  for (int i = 1; i < m; i++) {
    fin[p[i].second] = ans[p[i].first.second] ^ ans[p[i].first.first - 1] ^
                       query(p[i].first.first, p[i].first.second, 1, n, 1);
    for (int j = p[i].first.second; j > p[i + 1].first.second; j--) {
      if (num2[j]) {
        mp[num[j]][0]++;
        if (mp[num[j]][0] < mp[num[j]].size()) {
          change(mp[num[j]][mp[num[j]][0]], num[j], 1, n, 1);
          num2[mp[num[j]][mp[num[j]][0]]] = num[j];
        }
      }
    }
  }
  fin[p[m].second] = ans[p[m].first.second] ^ ans[p[m].first.first - 1] ^
                     query(p[m].first.first, p[m].first.second, 1, n, 1);
  for (int i = 1; i <= m; i++) printf("%d\n", fin[i]);
  return 0;
}
