1# Runtime: 947 ms (Top 34.04%) | Memory: 15.5 MB (Top 30.97%)2class Solution:3def totalHammingDistance(self, arr: List[int]) -> int:45total = 06for i in range(0, 31):7count = 08for j in arr:9count += (j >> i) & 110total += count * (len(arr) - count)11return total