def bin_digit(n: int):
    return len(bin(n)[2:]) + 1


MOD = 10**9 + 7

N = int(input())
An = list(map(int, input().split()))

digit = bin_digit(max(An))

res = 0
for d in range(digit):
    n0, n1 = 0, 0
    for i in range(N):
        if An[i] & 1 << d:
            n1 += 1
        else:
            n0 += 1

    temp = 2**d % MOD
    n = n0 * n1 % MOD
    temp *= n % MOD
    res = (res + temp) % MOD

print(res)
