#include <bits/stdc++.h>
using namespace std;
void calc_xor_sum_all(vector<int> &xor_all, const vector<int> &v) {
  xor_all.push_back(v.front());
  for (int i = 1; i < v.size(); i++) xor_all.push_back(xor_all.back() ^ v[i]);
}
void update_bit(vector<int> &bit, int pos, int delta) {
  while (pos < bit.size()) {
    bit[pos] ^= delta;
    pos |= pos + 1;
  }
}
int calc_xor_sum_bit(const vector<int> &bit, int l, int r) {
  int ans = 0;
  while (r >= 0) {
    ans ^= bit[r];
    r = (r & (r + 1)) - 1;
  }
  l--;
  while (l >= 0) {
    ans ^= bit[l];
    l = (l & (l + 1)) - 1;
  }
  return ans;
}
class Compare {
 public:
  bool operator()(const pair<int, pair<int, int> > &a,
                  const pair<int, pair<int, int> > &b) {
    return (a.second.second < b.second.second);
  }
};
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int &e : v) cin >> e;
  vector<int> xor_all;
  calc_xor_sum_all(xor_all, v);
  int q;
  cin >> q;
  vector<pair<int, pair<int, int> > > queries;
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    queries.push_back(make_pair(i, make_pair(l - 1, r - 1)));
  }
  stable_sort(queries.begin(), queries.end(), Compare());
  map<int, int> last_pos;
  vector<int> bit(n, 0);
  vector<int> answer(q);
  int query_no = 0;
  for (int i = 0; i < n && query_no != q; i++) {
    update_bit(bit, i, v[i]);
    if (last_pos.find(v[i]) != last_pos.end())
      update_bit(bit, last_pos[v[i]], v[i]);
    last_pos[v[i]] = i;
    while (query_no != q && queries[query_no].second.second == i) {
      auto top = queries[query_no];
      answer[top.first] =
          (top.second.first == 0
               ? xor_all[top.second.second]
               : xor_all[top.second.second] ^ xor_all[top.second.first - 1]) ^
          calc_xor_sum_bit(bit, top.second.first, top.second.second);
      query_no++;
    }
  }
  copy(answer.begin(), answer.end(), ostream_iterator<int>(cout, "\n"));
}
