def bi(x):

    x = int(x)

    i = 0

    o = [0]*61

    while x > 0:

        o[i] = x % 2

        x //= 2

        i += 1

    return o



N = int(eval(input()))

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



# print(*A,sep='\n')

a = 0

ruijoo = 1

bbb = 0

B = [0]*N

h = 0

while h < 61:

    i = 0

    isOne = 0

    while i < N:

        aaaa = A[i][h]

        isOne += aaaa

        B[i] = aaaa

        i += 1

    isZero = N - isOne

    C = [isOne,isZero]

    bbbb = 0

    i = 0

    while i < N:

        bbbb += C[B[i]]

        i += 1

    bbbb *= ruijoo

    bbb += bbbb

    bbb %= 1000000007

    ruijoo *= 2

    ruijoo %= 1000000007

    h += 1



bbb *= 500000004

bbb %= 1000000007

print(bbb)
def bi(x):

    x = int(x)

    i = 0

    o = [0]*61

    while x > 0:

        o[i] = x % 2

        x //= 2

        i += 1

    return o



N = int(eval(input()))

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



# print(*A,sep='\n')

ruijoo = 1

bbb = 0

B = [0]*N

h = 0

while h < 61:

    i = 0

    isOne = 0

    while i < N:

        aaaa = A[i][h]

        isOne += aaaa

        B[i] = aaaa

        i += 1

    isZero = N - isOne

    bbb += ruijoo * isZero * isOne

    bbb %= 1000000007

    ruijoo *= 2

    ruijoo %= 1000000007

    h += 1



bbb %= 1000000007

print(bbb)
def bi(x):
    x = int(x)
    i = 0
    o = [0] * 61
    while x > 0:
        o[i] = x % 2
        x //= 2
        i += 1
    return o


N = int(eval(input()))
A = list(map(bi, input().split()))
# print(*A,sep='\n')
a = 0
ruijoo = 1
bbb = 0
B = [0] * N
h = 0
while h < 61:
    i = 0
    isOne = 0
    while i < N:
        aaaa = A[i][h]
        isOne += aaaa
        B[i] = aaaa
        i += 1
    isZero = N - isOne
    C = [isOne, isZero]
    bbbb = 0
    i = 0
    while i < N:
        bbbb += C[B[i]]
        i += 1
    bbbb *= ruijoo
    bbb += bbbb
    bbb %= 1000000007
    ruijoo *= 2
    ruijoo %= 1000000007
    h += 1
bbb *= 500000004
bbb %= 1000000007
print(bbb)

def bi(x):
    x = int(x)
    i = 0
    o = [0] * 61
    while x > 0:
        o[i] = x % 2
        x //= 2
        i += 1
    return o


N = int(eval(input()))
A = list(map(bi, input().split()))
# print(*A,sep='\n')
ruijoo = 1
bbb = 0
B = [0] * N
h = 0
while h < 61:
    i = 0
    isOne = 0
    while i < N:
        aaaa = A[i][h]
        isOne += aaaa
        B[i] = aaaa
        i += 1
    isZero = N - isOne
    bbb += ruijoo * isZero * isOne
    bbb %= 1000000007
    ruijoo *= 2
    ruijoo %= 1000000007
    h += 1
bbb %= 1000000007
print(bbb)

-a = 0 -    C = [isOne, isZero] -    bbbb = 0 -    i = 0 -    while i < N: -        bbbb += C[B[i]] -        i += 1 -    bbbb *= ruijoo -    bbb += bbbb +    bbb += ruijoo * isZero * isOne -bbb *= 500000004