import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = (a&1).sum()
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)