import itertools
n = int(input())

a = list(map(int,input().split()))

m = len(bin(max(a))) - 2

b = []
for i in range(n):
    b.append(list(map(int,list(bin(a[i])[2:].zfill(m)))))

c = list(itertools.combinations(b,2))

xor = []
for d in c:
    count = []
    for i in range(m):
        if d[0][i] != d[1][i]:
            count.append(1)
        else:
            count.append(0)
    xor.append(count)        

ans = 0
for e in xor:
    for k in range(m):
        ans += (2**k) * e[k] % (10**9 + 7)

print(ans)