N=int(eval(input()))

M=10**9+7

A=[int(x) for x in input().split()]



ans=0

for i in range(60):

  one=sum([a>>i&1 for a in A])

  zero=N-one

  ans+=(one*zero)*pow(2,i,M)%M

  ans%=M

  #print(one,zero)

print(ans)
import numpy as np



N=int(eval(input()))

A=np.array([int(x) for x in input().split()])



ans=0

M=pow(10,9)+7

for i in range(100):

  one=np.sum((A>>i)&1)

  zero=N-one

  ans+=(one*zero)%M*pow(2,i,M)%M

  ans%=M

  #print(one,zero)

print(ans)
N = int(eval(input()))
M = 10**9 + 7
A = [int(x) for x in input().split()]
ans = 0
for i in range(60):
    one = sum([a >> i & 1 for a in A])
    zero = N - one
    ans += (one * zero) * pow(2, i, M) % M
    ans %= M
    # print(one,zero)
print(ans)

import numpy as np

N = int(eval(input()))
A = np.array([int(x) for x in input().split()])
ans = 0
M = pow(10, 9) + 7
for i in range(100):
    one = np.sum((A >> i) & 1)
    zero = N - one
    ans += (one * zero) % M * pow(2, i, M) % M
    ans %= M
    # print(one,zero)
print(ans)

+import numpy as np + -M = 10**9 + 7 -A = [int(x) for x in input().split()] +A = np.array([int(x) for x in input().split()]) -for i in range(60): -    one = sum([a >> i & 1 for a in A]) +M = pow(10, 9) + 7 +for i in range(100): +    one = np.sum((A >> i) & 1) -    ans += (one * zero) * pow(2, i, M) % M +    ans += (one * zero) % M * pow(2, i, M) % M