def solve():
    
    ans=0
    for i in range(n-1):
        for j in range(i+1,n):
            ans+=a[i]^a[j]
            if ans>=10**9+7:
                ans=ans%(10**9+7)
    print(ans%(10**9+7))
    
n=int(input())
a=list(map(int,input().split()))
solve()