# coding: utf-8

MOD = 10^9+7
N = int(input())
A = [int(a) for a in input().split()]
ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        ans = (ans + (A[i] ^ A[j])) % MOD
        
print(ans)