#include <bits/stdc++.h>   using namespace std;   const int MAX = 1e6 + 10;   int n, m, q, pos[MAX], bit[MAX], res[MAX], XOR[MAX];   pair<int, int> cache[MAX], a[MAX], b[MAX];   struct Node {     int lef, rig, tt;     bool operator<(const Node& other) const { return this->lef < other.lef; }   };   Node query[MAX];   void up(int i) {     int val = a[i].first;     while (i <= n) {       bit[i] ^= val;       i += i & (-i);     }   }   int get(int i) {     int res = 0;     while (i) {       res ^= bit[i];       i -= i & (-i);     }     return res;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , &cache[i].first);       a[i].first = cache[i].first;       cache[i].second = i;     }     sort(cache + 1, cache + 1 + n);     for (int i = 1; i <= n; ++i) {       if (i == 1 || cache[i].first > cache[i - 1].first) ++m;       a[cache[i].second].second = m;     }     for (int i = 1; i <= n; ++i) {       b[i] = pair<int, int>(pos[a[i].second], i);       pos[a[i].second] = i;       XOR[i] = XOR[i - 1] ^ a[i].first;     }     sort(b + 1, b + 1 + n);     scanf( %d , &q);     for (int i = 1; i <= q; ++i) {       scanf( %d %d , &query[i], &query[i].rig);       query[i].tt = i;     }     sort(query + 1, query + 1 + q);     int j = 1;     for (int i = 1; i <= q; ++i) {       while (j <= n && b[j].first < query[i].lef) up(b[j++].second);       res[query[i].tt] = XOR[query[i].rig] ^ XOR[query[i].lef - 1];       res[query[i].tt] ^= get(query[i].rig) ^ get(query[i].lef - 1);     }     for (int i = 1; i <= q; ++i) printf( %d n , res[i]);     return 0;   }   