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

ans = 0
for j in range(60):
    odd = 0
    even = 0
    for i in range(n):
        if a[i] % 2 == 0:
            even += 1
        else:
            odd += 1
    ans += even * odd * 2**j
    a = [i//2 for i in a]
    ans %= 10**9+7

print(ans)
