If last visit is not - 1 update - 1 at the idx equal to last_visit [ arr [ i ] ]
if last_visit [ arr [ i ] ] != - 1 : NEW_LINE INDENT update ( last_visit [ arr [ i ] ] + 1 , - 1 , bit , n ) NEW_LINE DEDENT