n=int(input())

l=10**9+7
numlist=[format(int(i),"060b") for i in input().split(" ")]
# print(numlist)


def xor(a,b):
    c=[]
    for i in range(60):
        if a[i]!=b[i]:
            c.append("1")
        else:
            c.append("0")
    c="".join(c)
    c=int(c, 2)
    return c
    
        

ans=0
for i in range(n-1):
    for j in range(i+1,n):
        ans+=xor(numlist[i],numlist[j])
    ans=ans%l
print(ans)
        