mod = 10 ** 9 + 7

N = int(input())

A = list(map(int, input().split()))


result = 0
Zcount = 0
Bit0 = 0
Bit1 = 0
while Zcount < 60:
    for i in range(0, len(A)):
        if A[i] % 2 == 0:
            Bit0 += 1
            A[i] //= 2
        else:
            Bit1 += 1
            A[i] //= 2
    result += (2 ** Zcount) * (Bit0 * Bit1)
    Zcount += 1
    Bit0 = 0
    Bit1 = 0
print(result % mod)