import numpy as np
mod = 10**9+7
n = int(input())
a = np.array(list(map(int,input().split())))

result = 0
for i in range(62):
    count_one = sum(a%2)
    bina = 1
    for j in range(i):
        bina = bina*2%mod
    result += count_one*(n-count_one)*bina%mod
    a = a >> 1
print(result%mod)