import numpy as np
n = int(input())
a = list(map(int, input().split()))
sum = 0
list = []
for i in range(0,n-1):
    for j in range(i+1,n):
        list = np.append(list,a[i]^a[j])

ans = np.mod(np.sum(list),10**9+7)
print(int(ans))