n=int(input())
a=list(map(int,input().split()))
s=0
for i in range(n):
    for j in range(i+1,n):
        k=0
        if a[i]>a[j]:
            m=a[i]
            s1=a[j]
        else:
            m=a[j]
            s1=a[i]
        while s1>0:
            if m%2!=s1%2:
                s+=2**k
            m=m//2
            s1=s1//2
            k+=1
        s+=m*(2**k)
print(s%(10**9+7))