1426. Counting Elements Updated: 2024-03-12 1 min read Algorithms , LeetCode On This PageLeetCode problem 1426class Solution: def countElements(self, arr: List[int]) -> int: cnt = Counter(arr) return sum(v for x, v in cnt.items() if cnt[x + 1])