Count Distinct Element Leetcode Python Coding