If Previous element subsequence count is greater than zero then increment subsequence count of current element and decrement subsequence count of the previous element .
else if ( cnt [ a [ i ] - 1 ] > 0 ) { cnt [ a [ i ] - 1 ] -- ; cnt [ a [ i ] ] ++ ; } }