n = input()
l = list(map(int,input().split()))

s = 0

for i in range(61):
    z=0
    o=0
    for n in l:
        if (n >> i)%2 == 0:
            z += 1
        else:
            o += 1
    s += (z*o)*(2**i)
    s = s % (10**9+7)

print(s)
