def sockMerchant(n, ar):
    # Write your code here
    d = dict()
    
    for s in ar:
        if d.get(s) is None:
            d[s] = 1
        else:
            d[s] += 1
        
    cnt = 0
    for _, v in d.items():
        cnt += v // 2
            
    return cnt