import numpy as np

n = input()
l = np.array(list(map(int,input().split())) ,dtype='uint64')

s = 0

for i in range(61):
    z=0
    o=0
    for n in l:
        if (n >> np.uint64(i))%2 == 0:
            z += 1
        else:
            o += 1
    s += (z*o)*(2**i)

print(s% (10**9+7))
