n = int(input())
list_num = list(map(int, input().split()))
ans = []

for i in range(n-1):
    for j in range(i+1, n):
        ans.append(list_num[i] ^ list_num[j])


b = 10**9 + 7
a = sum(ans) % b

print(a)