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

s = [0] * 61
for i in range(n):
    for j in range(61):
        if ((1 << j) & a[i]) > 0:
            s[j] += 1

mod = 10**9 + 7

ans = 0
for i in range(n):
    for j in range(61):
        if ((1 << j) & a[i]) == 0:
            ans += pow(2, j, mod) * s[j] % mod
        else:
            ans += pow(2, j, mod) * (n-s[j]) % mod
        ans %= mod

print(ans)