You are given an array which have at most 200000 elements. After that there are q queries. q<=200000. Each query contains three numbers s,e,k. How to for each query answer how many numbers in range [s,e] appear exactly k times? Is there any possibility to solve this without Mo's algorithm?