MOD = 10**9 + 7
N = int(input())
A = list(map(int,input().split()))

ans = 0
mem = {}
for i in range(N-1):
  for j in range(i+1, N):
    key = str(min(i,j)) + '-' + str(max(i,j))
    if key not in mem:
      mem[key] = (A[i]^A[j])%MOD
    ans += mem[key]
      
print(ans%MOD)
