Sequence II HDU - 5919(主席樹)
In the i-th query, you are given two integers lili and riri. Consider the subsequence ali,ali+1,ali+2,⋯,ariali,ali+1,ali+2,⋯,ari.
We can denote the positions(the positions according to the original sequence) where an integer appears first in this subsequence as
Note that kiki is the number of different integers in this subsequence. You should output