import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
K = 60

bit_nums = [0 for _ in range(K)]
ans = 0
mod = 10 ** 9 + 7

for i in range(K):
    bit_nums[i] = np.sum([A >> i & 1])
    
ans = 0
for i in range(K):
    ans += (2 ** i) * (bit_nums[i] * (N - bit_nums[i]))
    ans %= mod
  
print(ans)