• + 13 comments

    Alternatively, without an import:

    input()
    socks = input().strip().split()
    pairs = 0
    
    for element in set(socks):
    	pairs += socks.count(element) // 2
    print(pairs)
    

    There's also no need for integer casting, since we're just counting like things; and these are really just labels, not numbers we'll be doing arithmetic on.