Leetcode Duplicate Element Count In Array In Python