n=int(input())
a=list(map(int,input().split()))
s=[0]*60
m=10**9+7
for i in a:
    t=bin(i)[2:][::-1]
    for i in range(len(t)):
        if t[i]=="1":
            s[i]+=1
c=0
for i in range(60):
    c=(c+s[i]*(n-s[i])*pow(2,i,m))%m
print(c)