For an array, we can build a
SegmentTree for it, each node stores an extra attribute
count to denote the number of elements in the the array which value is between interval start and end. (The array may not fully filled by elements)
query method with three parameters
end, find the number of elements in the in array's interval [start, end] by the given root of value SegmentTree.