Traverse in the map to sum up the ( occurrences - 1 ) of duplicate elements
for ( auto it = mp . begin ( ) ; it != mp . end ( ) ; it ++ ) { if ( ( * it ) . second > 1 ) count += ( * it ) . second - 1 ; } return count ; }