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


mod = 10**9 + 7

ans = 0
for i in range(61):
    zero = 0
    one = 0
    for a_ in a:
        if (a_ >> i) & 1:
            one += 1
        else:
            zero += 1
    ans += one * zero * pow(2, i, mod) % mod
    ans %= mod

print(ans)