Iterate over the array ar [ ]
for ( i = 1 ; i <= n ; i ++ ) { ar [ i ] = m . get ( ar [ i ] ) ; if ( cnt . has ( ar [ i ] ) ) cnt . set ( ar [ i ] , cnt . get ( ar [ i ] ) + 1 ) else cnt . set ( ar [ i ] , 1 ) }