N = int(input())
A = list(map(int, input().split()))

r = []
for i in range(N - 1):
  for j in range(i+1, N):
    #r += (A[i]) ^ (A[j])
    r.append((A[i]) ^ (A[j]))

print(sum(r) % (10**9 + 7))

#print(bin(10**9 + 7))