import itertools
import math
N=int(input())
A=list(map(int,input().split()))

answer=0
sum=0
base=0
for j in range(N):
    A[j]=str(bin(A[j])).rjust(60,"0")
B=list(itertools.combinations(A,2))

for i in range(len(B)):
    for k in range(60):
        if B[i][0][59-k]=="0" and B[i][1][59-k]=="1":
            base+=2**k
        elif B[i][0][59-k]=="1" and B[i][1][59-k]=="0":
            base+=2**k
        elif B[i][0][59-k]=="b" and B[i][1][59-k]=="1":
            base+=2**k
        elif B[i][0][59-k]=="1" and B[i][1][59-k]=="b":
            base+=2**k
    sum+=base
    base=0
print(sum%(10**9+7))