n = int(input())
a = list(map(lambda x:list(map(int, reversed(bin(int(x) + 2**60)[2:]))), input().split()))

MOD = 10 ** 9 + 7

#print(a)
#exit()

ans = 0
d = 1
for j in range(60):
    x = 0
    for i in range(n):
        x += a[i][j]
    ans = (((x * (n-x)) % MOD) * d % MOD + ans) % MOD
    d = d * 2 % MOD

print(ans)
