# Problem D - Xor Sum 4

# input
N = int(input())
a_nums = list(map(int, input().split()))

# initialization
ans = 0
MOD = 10**9 + 7

# count
for i in range(60):
    tmp_count = 0
    one_count = 0
    zero_count = 0
    for a in a_nums:
        if (a>>i)&1==1:
            one_count += 1
        else:
            zero_count += 1
    tmp_count = one_count * zero_count
    ans += (tmp_count * (2**i))%MOD

# output
print(ans%MOD)
