MOD = int(1e9) + 7

n = int(input())
a = list(map(int, input().split()))
p = [0]*(n+10)
ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        b = a[i]^a[j]
        b = b%MOD
        ans +=b
print(ans%MOD)