Count zero-AND pairs

Write codeHard35 min

Your task

Given an array 'nums' of non-negative integers, count the number of ordered pairs (i, j) (i and j range independently over all indices, including i == j) such that nums[i] & nums[j] == 0, where & is bitwise AND. Return the count. 1 <= len(nums) <= 40000, 0 <= nums[i] < 2^16.

Examples

count_and_zero_pairs(nums: list[int]) -> int
Example 1
Inputcount_and_zero_pairs([1, 2, 3])
Output2