Number of distinct elements in an interval(Dquery on spoj).We have to process all the queries offline here