#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 4;   int n, q, A[N], P[N], R[N], res[N], S[N * 2];   map<int, int> M;   vector<int> Q[N];   inline void Add(int le, int ri, int val) {     le--;     ri--;     for (le += n, ri += n; le < ri; le >>= 1, ri >>= 1) {       if (le & 1) S[le++] ^= val;       if (ri & 1) S[--ri] ^= val;     }   }   inline int Get(int i) {     int ret = 0;     for (i--, i += n; i; i >>= 1) ret ^= S[i];     return (ret);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &A[i]), P[i] = (P[i - 1] ^ A[i]);     scanf( %d , &q);     for (int i = 1, l; i <= q; i++)       scanf( %d%d , &l, &R[i]), Q[l].push_back(i), res[i] = (P[R[i]] ^ P[l - 1]);     for (int i = 1; i <= n; i++) M[A[i]] = n + 1;     for (int i = n; i; i--) {       Add(i, M[A[i]], A[i]);       for (int &id : Q[i]) res[id] ^= Get(R[id]);       M[A[i]] = i;     }     for (int i = 1; i <= q; i++) printf( %d n , res[i]);     return (0);   }   