Think about how you would do it manually. I'd start with the first element in the array, and then search for it's match. If I found it, I'd remove the second one from the array. If I didn't, I'd remove the element from the array.
Then search again from the next element, if any.
At the end, the number of pairs is the number of remaining elements.
| Start
V
11, 5, 7, 9, 11, 3, 5 - match: remove.
| Start
V
11, 5, 7, 9, 3, 5 - match - remove
| Start
V
11, 5, 7, 9, 3 - no match - remove
| Start
V
11, 5, 9, 3 - no match - remove
| Start
V
11, 5, 3 - no match - remove
| Start
V
11, 5 - no more elements : 2 matches.
Hint: The easiest way to remove an element is to overwrite it with the last one, and reduce the count by one...