Write a function that counts the duplicates in a list.
Return the number of duplicate occurrences, counting every appearance after the first occurrence of a value. For example, [1, 2, 2, 3, 3, 3] contains three duplicate occurrences. Implement count_duplicates(nums), where nums is a list of hashable values and the result is an integer.
def count_duplicates(nums):