import numpy as np
n = int(input())
A_list = np.array([[i for i in bin(int(A))[2:].zfill(61)] for A in input().split()])
ans = 0

for i in range(61):
  one = np.count_nonzero(A_list[:,i]=="1")
  ans += 2**(60-i) * one * (n-one)
  ans %= 10**9+7

print(ans)