n = int(input())

a = [int(x) for x in input().split()]

mod = 10**7 + 7
ans = 0
for i in range(60):
    bit = 2**i
    one_count = 0
    for x in a:
        one_count += 1 if x & bit != 0 else 0
    ans += (n-one_count) * one_count * bit % mod

print(ans)
