n = int(input())
a=list(map(int, input().split()))
b = len(a)
c = 0

for i in range(n-1):
    for j in range(i,n):
        c = c + (a[i] ^ a[j])
        if c>=(10**9+7):
            c = c % (10**9+7)
        
print(c)