Can you write a function to count matching numbers within an array?
Implement count_matching_numbers(nums) to return the number of non-overlapping pairs of equal integers. Each array element may belong to at most one pair; return 0 when no pair exists.
Examples: [1, 2, 1, 2] returns 2; [1, 1, 1] returns 1. Constraints: 0 <= len(nums) <= 1000, and each value is an integer.
def count_matching_numbers(nums):