For this weeks algorithm problem, we are given an array of integers representing the color of each sock, and set to determine how many pairs of socks with matching colors there are.

First, set a count of pairs of socks and sort the array we are given. Then we loop through the array *n *times. If the element at index[i] is the same as the next element, add 1 to pairs and continue the loop. Finally, return the total number of pairs.