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

ans = tuple(
  A[i]^A[j] for i in range(N) for j in range(i+1, N)
)
'''for i in range(N):
  for j in range(i+1, N):
    ans += A[i]^A[j]'''
    
print(sum(ans)%MOD)