Storing the number of occurrence of elements in unordered map
for ( let i = 0 ; i < n ; i ++ ) { if ( ! m . has ( v [ i ] ) ) m . set ( v [ i ] , 1 ) ; else m . set ( v [ i ] , m . get ( v [ i ] ) + 1 ) ; } let count = 0 ;