n=int(input())
ans=0
def xor(x,y):
    return (int(bin(x^y),2))
    
l=list(map(int,input().split()))
for i in range(n-1):
    for j in range(i+1,n):
        ans+=xor(l[i],l[j])
        
print(ans%(10**9+7))