• + 1 comment

    Pythonic solution:

    def sockMerchant(n, ar):
        return sum([ar.count(color)//2 for color in set(ar)])