#ABC-D

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

solve()