N = int(input())
A = list(map(int, input().split()))
MOD = 1000000007

sum_all = 0
for i in range(60):
    ones = 0
    zeros = 0

    for a in A:
        if a & (1 << i):
            ones += 1
        else:
            zeros += 1

    sum_all += pow(2, i, MOD) * ones * zeros % MOD


print(sum_all % MOD)
