Function to solve each query
static void SolveQuery ( int [ ] arr , int n , List < List < int > > Q ) { int x ; for ( int i = 0 ; i < Q . Count ; i ++ ) { if ( Q [ i ] [ 0 ] == 1 ) { x = getCount ( arr , n , Q [ i ] [ 1 ] , Q [ i ] [ 2 ] ) ; Console . Write ( x + " ▁ " ) ; } else { setElement ( arr , n , Q [ i ] [ 1 ] , Q [ i ] [ 2 ] ) ; } } }