Count mirror matches

Write codeEasy10 min

Your task

Given an integer array nums of length n, count how many mirror pairs match: positions i and n-1-i (for i < n/2) holding equal values. The middle element of an odd-length array pairs with itself and is never counted. Return the count. Example: [1, 5, 3, 5, 1] gives 2, positions 0 and 4 match, positions 1 and 3 match, and the middle 3 is ignored.

Examples

count_mirror_matches(nums: list[int]) -> int
Example 1
Inputcount_mirror_matches([1, 5, 3, 5, 1])
Output2