n,*a=list(map(int,open(0).read().split()))

c=0

for i in range(61):

  i=2**i

  t=sum(i&b and 1for b in a)

  c=(c+t*(n-t)*i)%(10**9+7)

print(c)
n,*a=list(map(int,open(0).read().split()))

c=0

for i in range(61):t=sum(2**i&b>0for b in a);c=(c+t*(n-t)*2**i)%(10**9+7)

print(c)
n, *a = list(map(int, open(0).read().split()))
c = 0
for i in range(61):
    i = 2**i
    t = sum(i & b and 1 for b in a)
    c = (c + t * (n - t) * i) % (10**9 + 7)
print(c)

n, *a = list(map(int, open(0).read().split()))
c = 0
for i in range(61):
    t = sum(2**i & b > 0 for b in a)
    c = (c + t * (n - t) * 2**i) % (10**9 + 7)
print(c)

-    i = 2**i -    t = sum(i & b and 1 for b in a) -    c = (c + t * (n - t) * i) % (10**9 + 7) +    t = sum(2**i & b > 0 for b in a) +    c = (c + t * (n - t) * 2**i) % (10**9 + 7)