n = int(input())

a = [0 for i in range(n)]
a = [int(s) for s in input().split()]
res = 0

dig_0 = [0 for i in range(60)]
dig_1 = [0 for i in range(60)]

for i in range(n):
    #print("----")
    for j in range(60):
        #print(bin(a[i]>>j))
        s = bin(a[i]>>j)[-1]
        if(s == "1"):
            dig_1[j] += 1
        else:
            dig_0[j] += 1

#print(dig_1)
for i in range(60):
    #print(dig_0[i],dig_1[i])
    res += dig_0[i]*dig_1[i]*2**i
    #print(res)
md = 10**9 + 7
print(res%md)
