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(input())
A = list(map(bi,input().split()))

# print(*A,sep='\n')
a = 0
ruijoo = 1
bbb = 0
for h in range(61):
    B = list(map(lambda x: x[h],A))
    isZero = sum(map(lambda x: x == 0,B))
    isOne = sum(map(lambda x: x == 1,B))
    bbb += sum(map(lambda x:isZero if x else isOne,B))*ruijoo
    ruijoo *= 2
    ruijoo %= 1000000007

bbb *= 500000004
bbb %= 1000000007
print(bbb)