Count Nice Pairs Leetcode Python