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

mod = 1000000007
bit = pow(2, 59)
ans = 0
while bit != 0:
    cnt = 0
    for i in range(len(a)):
        if a[i] // bit == 1:
            cnt += 1
        a[i] %= bit
    ans += ((cnt * (n-cnt)) % mod * bit) % mod
    ans %= mod
    bit //= 2

print(ans)