n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(n-1):
    for j in range(i+1,n):
        x=format(a[j],"b")
        length=len(x)
        z=format(a[i],"b")
        y=z.zfill(length)
        anss=""
        for k in range(length):
            if x[k]==y[k]:
                anss+="0"
            else:
                anss+="1" 
        ans+=int(anss,2) 
print(ans%(10**9+7))                      
                