Count the occurences of number and store in count
for ( var i = 0 ; i < n ; i ++ ) if ( count . has ( arr [ i ] ) ) count . set ( arr [ i ] , count . get ( arr [ i ] ) + 1 ) else count . set ( arr [ i ] , 1 )