import numpy as np
N = int(input())
A = np.array(input().split(), dtype=np.int64)

X = (1 << np.arange(60, dtype=np.int64)) & A.reshape(-1,1)
B = np.sum(X != 0, axis=0)


total = 0

for i,count in enumerate(B):
  total += count * (N - count) * (1 << i)

print(total % (10**9 + 7))