import math

N = int(input())
a = list(map(int, input().split()))

ans = 0
a_max = max(a)
alog = int(math.log2(a_max))+1

for i in range(alog):
    cnt0 = 0
    cnt1 = 0
    for j in a:
        p = pow(2, i)
        cnt1 += ((j & p) == p)
        cnt0 += ((j & p) == 0)
    ans += (cnt0 * cnt1)*(2**i)%(10**9+7)

print(ans%(10**9+7))