n=int(input())
alist=list(map(int,input().split()))
sosu=10**9+7
tenlist=[0]*60

for a in alist:
    tmp=str(format(a,"b"))
    for i in range(len(tmp)):
        if tmp[-(i+1)]=="1":
            tenlist[i] = tenlist[i]+1

out=0
for i, ten in enumerate(tenlist):
    out += (ten*(n-ten))*pow(2,i,sosu)
    out %= sosu


print(int(out))

        