from sys import stdin 
n = int(stdin.readline().rstrip())
s = [int(x) for x in stdin.readline().rstrip().split()]
answer = 0
for i in range(n):
    if i != n-1:
        for j in range(i+1,n):
            answer += s[i] ^ s[j]
print(answer % 1000000007)


