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(60):
    count_one = sum(a&1)
    result += count_one*(n-count_one)*(2**i)%mod
    a = a >> 1
print(result%mod)