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

cnt = 0
#count = 0

for i in range(n-1):
  for j in range(i+1, n):
    cnt += (A[i] ^ A[j]) % (10** 9 + 7)
    #count += 1
    
print(cnt % (10** 9 + 7))