MOD = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    a[i] = format(a[i], '060b')
s = 0
for i in range(60):
    c = 0
    for j in range(n):
        if a[j][i] == '0':
            c += 1
    s += pow(2,59-i,MOD)*c*(n-c)%MOD
print(s%MOD)