# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
bins = [format(i, "b").zfill(60) for i in A]

keta = []
for i in range(60):
    tmp = list(map(int, [r[i] for r in bins]))
    keta.append(tmp[:])
keta.reverse()

ans = 0
for i in range(60):
    s = sum(keta[i])
    ans += s * (N - s) * 2 ** i
print(ans % mod)