n = int(input())
a = list(map(int, input().split()))
mod = 1000000007
def make_bin(i):
    return list(map(int, list(format(i, "060b"))))


a_bin = []
for i in range(n):
    a_bin.append(make_bin(a[i]))

ans = 0
for i in range(60):
    index_i = []
    for j in range(n):
        index_i.append(a_bin[j][i])
    ones = index_i.count(1)
    ans += (ones*(n-ones)*(2**(59-i))) % mod

ans %= mod
print(ans)