24 lines
442 B
Python
24 lines
442 B
Python
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
|
|
def bitwise_difference(A):
|
|
l = len(A)
|
|
s = 0
|
|
for i in range(32):
|
|
n1 = 0
|
|
for j in range(l):
|
|
n1 += A[j] & 1
|
|
A[j] = A[j] >> 1
|
|
n0 = l - n1
|
|
s += n1 * n0
|
|
return s
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.stdin.readline()
|
|
A = sys.stdin.readline().split()
|
|
for i in range(len(A)):
|
|
A[i] = int(A[i])
|
|
|
|
print(bitwise_difference(A))
|