arr = [1, 2, 2, 3, 4, 4, 4]
arr.sort()

count = 0     
set_count = 1 

for i in range(len(arr)-1):
    if arr[i] == arr[i+1]:
        set_count += 1
        if set_count == 2:
            count += 1
    else:
        set_count = 1

print(count)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: